#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,x;
	cin>>x;
	if(x%2==0){
		cout<<"2"<<endl;
	}
	if(x%3==0){
		cout<<"3"<<endl;
	}
	if(x%5==0){
		cout<<"5"<<endl;
	}
	if(x%7==0){
		cout<<"7"<<endl;
	}
}
/**************************************************************
	Problem: 1299
	User: caiqiaoxi
	Language: C++
	Result: Accepted
	Time:12 ms
	Memory:2072 kb
****************************************************************/