Python Distinct
def distinct(a: list[int]) -> int:
    return len(set(a))

This counts unique values by tracking what has already been seen.