def solution(A): a = set(A) for i, _ in enumerate(A, 1): if i in a: continue return i solution(A) # 3