+ 제목
# 소들의 헤어스타일 1
# import sys
# sys.setrecursionlimit(78956727)
# a = int(input())
# st = []
# count = 0
# def ax (gap):
# global st,count
# #print(st,count)
# if len(st) > 0 and (st[-1] <= gap or (gap == -1 and len(st) > 1 and st[-1] < st[-2])):
# st.pop()
# count += len(st)
# ax(gap)
# return
# for i in range(a):
# x = int(input())
# ax(x)
# st.append(x)
# ax(-1)
# print(count)
# a = int(input())
# st = []
# count = 0
# for i in range(a):
# if i<a:
# x = int(input())
# # print(st,count)
# if i > 0 and st[-1] <= x:
# for j in range(len(st)):
# if st[-1] <= x:
# st.pop()
# else:
# break
# if len(st) > 0 and st[-1] > x:
# count += len(st)
# if i<a:
# st.append(x)
# print(count)
a = int(input())
st = []
x = list(input().split())
for i in range(1,a+1):
if i==0:
st.append(x[a-i])
print('0',end = '')
continue
if x[i] > st[-1]:
for j in range(len(st)):
if x[i] > st[-1]:
st.pop()
else:
break
if x[i] < st[-1]:
print(' ',len(st),end='')
st.append(x[i])1회 조회




