import math


def mobius(n) :
    """
    Returns the value of mobius function for positive integer n.

    Parameters
    ----------
    n : int
        denotes positive integer for which the value of mobius function is needed
    return : int
        returns the value of mobius function

    """
    if(n<1 or n!=int(n)):
        raise ValueError(
            "n must be positive integer"
        )
    if(n == 1):
        return 1
    if(n == 2):
        return -1
    p = 0
    if (n % 2 == 0) :
     
        n = int(n / 2)
        p = p + 1
        if (n % 2 == 0) :
            return 0

    for i in range(3, int(math.sqrt(n)) + 1) :
        if (n % i == 0) :
         
            n = int(n / i)
            p = p + 1
            if (n % i == 0) :
                return 0
        i = i + 2   
     
    if(p % 2 == 0) :
        return -1
    else :
        return 1