n = gets.to_i i = 2 count2 = 0 count3 = 0 factorX = 0 while i ** 2 <= n while n % i == 0 n /= i if i == 2 count2 += 1 elsif i == 3 count3 += 1 else factorX = i end end i += 1 end if count3 > 0 puts 3 elsif count2 >= 2 puts 4 elsif factorX != 0 puts factorX else puts n end