lst = [int(i) for i in input().strip().split()] a = 0 for i in range(len(lst)): if lst[i] - a > 1: break a = lst[i] print(str(a + 1))