n=gets.to_i [3,4].each{|i| if n%i==0 puts i exit end } 5.step((n**0.5).floor,2){|i| if n%i==0 puts i exit end } puts n%2==0 ? n/2 : n