i = list(map(int, input().split())) c = 1 for x in i: if c != x: break c += 1 print(c)