M = list(map(int, input().split())) ans = "" for i in range(9): if i + 1 != M[i]: ans = i + 1 break if ans == "": print("10") else: print(ans)