# 制約チェック N = int(input()) assert 1 <= N and N <= 500000 A = list(map(int, input().split())) assert len(A) == N for a in A: assert 0 <= a and a <= 500000