num = list(map(int, input().split())) count = 1 for i in range(10): if i > 8: print(i + 1) break elif count != num[i]: print(count) break count += 1