n=input() for i in map(int,raw_input().split())[::-1]:n-=i==n print n