#include <iostream>
using namespace std;
int main() {
int N, minN;
cin >> N;
minN = 2;
while ( N % minN !=0 ) {
minN = minN + 1;
}
cout << minN;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpIHsKICBpbnQgTiwgbWluTjsKICBjaW4gPj4gTjsKICBtaW5OID0gMjsKICAgIHdoaWxlICggTiAgJSBtaW5OICE9MCApIHsKICAgICBtaW5OID0gbWluTiArIDE7CiAgICB9CiAgICBjb3V0IDw8IG1pbk47CiAgcmV0dXJuIDA7Cn0=