import sys
n = int(sys.stdin.readline())
L = list(str(n))
L = list(map(int, L))
K = '0123456789'
K = list(map(int,list(str(K))))
S = [0]*len(K)
for i in range(len(K)):
    S[i] = L.count(K[i])
S[6] = int(round((S[6]+S[9])/2))
print(max(S[0:9]))
