require 'prime' n=gets.to_i c=Prime.prime_division(n) c.each{|e| if e[0]==2 if n==3||c.include?(3) p 3;exit elsif e[1]>1 p 4;exit end next end p e[0] exit } p n