b = list(map(int, input().split())) for i in range(10): if b[i] == i+1: if b[i] == 9 and i == 8: print(10) break pass else: print(i+1) break