import sys line = [int(i) for i in input().split()] if line[0] != 1: print("1") sys.exit() if line[8] != 10: print("10") sys.exit() for i in range(9): if line[i+1] != line[i] + 1: print(line[i] + 1) sys.exit()