n=gets.to_i 3.step(n**0.5,2){|i| if n%i==0 puts i.to_i exit end } puts n%2==0&&n%4>0 ? n/2 : n