#coding: UTF-8 import sys from operator import itemgetter import re import itertools import math N = input() for i in range(3,int(math.sqrt(N)+1)): if (N%i==0): print i break