L=list(map(int,__import__("sys").stdin.read().split(","))) for i in range(80): L = [ (l-1) for l in L ] n = sum( l < 0 for l in L) L = [ l if l>=0 else 6 for l in L ] L += [8]*n print(len(L))