# Arup Guha
# 5/29/2023
# Solution to 2023 NAC Problem I: Power of Divisors

# Returns -1 if kth root of n is not integral, or the root if it exists.
def root(n,k):

    low = 1
    high = 1000000000

    # Run a binary search here.
    while low <= high:

        mid = (low+high)//2

        tmp = mid**k

        # Too small guess higher.
        if tmp < n:
            low = mid+1

        # Too big guess lower.
        elif tmp > n:
            high = mid-1

        # Found kth root of n.
        else:
            return mid

    return -1

# Returns the number of divisors of n via search up to square root.
def numD(n):

    i = 1
    res = 0

    # This is good enough for our purposes.
    while i*i <= n:

        if n%i == 0:
            res+=1
            if i*i < n:
                res+=1

        i+=1

    return res
    
def main():

    # Get input
    n = int(input())
    res = -1
    mye = 2

    # Hard code this.
    if n == 1:
        res = 1

    # Loop through potential exponents.
    while 2**mye <= n:

        # Check if this is a valid root.
        base = root(n,mye)
        
        # If it is, see if this works.
        if base != -1:
            x = numD(base)

            # It works so update our result, no break
            # This ensures smallest answer.
            if x == mye:
                res = base

        # Go to next.
        mye+=1

    # Ta da!
    print(res)

main()

