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