N = input() cou = 0 for i in range(len(N)): if cou == 0: if N[i] == '3': cou += 1 else: if N[i] != '3': cou += 1 else: cou = 0 break print(cou)