import java.util.*; class A { static Scanner s = new Scanner(System.in); public static void main(String[] args) { long in = s.nextLong(); long l = 3; while(in%l!=0){ l+=2; } System.out.println(l); } }