N = input() if len(N) != 1: if N[-1] != "3": print(-1) else: print(len(N)-1) else: if int(N) == 1: print(1) else: print(-1)