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