var
max, c,t, count:integer;
begin
write('c = ');
readln(c);
t := c;
max := t mod 10;
while t <> 0 do
begin
if max < t mod 10 then
max := t mod 10;
t := t div 10;
end;
t := c;
count := 0;
while t <> 0 do
begin
if t mod 10 = max then
count := count + 1;
t := t div 10;
end;
writeln('Count = ', count);
readln
end.