y=1+int(input()) while True: s1= set() for it in str(y): s1.add(it) if len(s1)==4: break y+=1 print(y)