def solution(n: int = 100) -> int:
    collect_powers = set()

    current_pow = 0

    n = n + 1  # maximum limit

    for a in range(2, n):
        for b in range(2, n):
            current_pow = a**b  # calculates the current power
            collect_powers.add(current_pow)  # adds the result to the set
    return len(collect_powers)