list1 = [int(i) for i in input().split(" ")] max_num = int(list1[0]) for i in range(0,max_num): if i not in list1: print(i) break