bn = list(map(int, input().split())) ans = 10 index = 0 for i in range(1, 10): if bn[index] != i: ans = bn[index] - 1 break index += 1 print(ans)