a=0 B = input() while str(a) in B: a+=1 print(a)