#coding: UTF-8 import sys from operator import itemgetter import re import itertools import math N = input() if (N%3==0): print 3 elif (N%4==0): print 4 else: while (N%2==0): N/=2 flg = True for i in range(3,long(math.sqrt(N)+1)): if (N%i==0): print i flg = False break if (flg) : print N