N = int(input()) A = list(map(int, input().split())) ans = [] for i in range(A[0]): while A[-1] < i + 1: A.pop() ans.append(len(A)) print(*ans)