Write an efficient function in Python to check if a number is Armstrong number or not.
def isArmstrongNumber(n):
    length = len(str(n))
    total = 0

    temp = n
    while temp > 0:
        digit = temp % 10
        total += digit ** length
        temp //= 10
    return n == total