#include<iostream.h> int main() { long n,k=0,c; cin>>n; c=n%10; while(n) { if(n%10==c) k++; n=n/10; } cout<<k; return 0; }