import numpy as np n = int(input()) A = list(map(int,input().split(' '))) result = [] for i in range(n): if i+1 in A: result.append(n-A.index(i+1)) else: result.append(0) for index,r in enumerate(result): result[index] = max(result[:index+1]) print(' '.join(list(map(str,result))))