long long int u,i;main(){scanf("%lld",&u);for(i=3;i<2e6;i++)if(u%i<1)return 0*printf("%d",i);return 0*printf("%lld",u%2?u:u/2);}