B = list(map(int,input().split())) ans = 0 for i in range(9): if not B[i] == i + 1 : ans = B[i] - 1 break if ans == 0: print(10) else: print(ans)