n = int(input()) retu = 3 while n%retu != 0: retu+=1 print(retu)