from itertools import count def calc_positive_divisors(num: int) -> dict[int, int]: if num < 2: raise ValueError divisors = {} for divisor in count(2): if divisor ** 2 > num: if num != 1: divisors[num] = 1 break while num % divisor == 0 and num != 1: try: divisors[divisor] += 1 except KeyError: divisors[divisor] = 1 num //= divisor return divisors def main(): X = int(input()) divisors = calc_positive_divisors(X) Y = 1 for divisor, count_ in divisors.items(): if count_ % 2 == 1: Y *= divisor print(Y) if __name__ == "__main__": main()