n=int(input()) x=1 while n:x+=1;n-=~-2**x%x<2!=print(x)