barr = [int(x) for x in input().split()] for i in range(1, 10): if barr[i - 1] != i: print(i) exit(0) print("10")