#ccc 2013 j3 
def Solution():
    def distinct(year):
        y = str(year)
        for digit in y:
            if y.count(digit) > 1:
                return False
        return True
    
    year = int(input()) + 1
    while not distinct(year):
        year += 1

    print(year)

Solution()

3057bf49814a3efd5a62140b1acbc8131f7687c4
<mask token>

def Solution():

    def distinct(year):
        y = str(year)
        for digit in y:
            if y.count(digit) > 1:
                return False
        return True
    year = int(input()) + 1
    while not distinct(year):
        year += 1
    print(year)


<mask token>

def Solution():

    def distinct(year):
        y = str(year)
        for digit in y:
            if y.count(digit) > 1:
                return False
        return True
    year = int(input()) + 1
    while not distinct(year):
        year += 1
    print(year)


Solution()

#ccc 2013 j3 
def Solution():
    def distinct(year):
        y = str(year)
        for digit in y:
            if y.count(digit) > 1:
                return False
        return True
    
    year = int(input()) + 1
    while not distinct(year):
        year += 1

    print(year)

Solution()
