#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
    if(n%2==0){
    	cout<<"2"<<endl;
	}
	if(n%3==0){
    	cout<<"3"<<endl;
	}
	if(n%5==0){
    	cout<<"5"<<endl;
	}
	if(n%7==0){
    	cout<<"7";
	}

	return 0;
}

/**************************************************************
	Problem: 1299
	User: lvrenxiang
	Language: C
	Result: Compile Error
****************************************************************/