B = list(map(int,input().split())) B.sort() for i in range(1,10): if ((i == B[i-1]) and i<=8): continue elif((i==B[i-1])and i==9): i +=1 else: break print(i)