#include <iostream>
using namespace std;
int main()
{
int m[45001];
int n, p, i, j;
cin >> n;
for(int i=1;i<=n;i++)
{
cin >> p;
j = i-1;
while(j>0 && p>m[j])
m[j+1] = m[j--];
m[j+1] = p;
cout << j+1 <<endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKQp7CiAgICBpbnQgbVs0NTAwMV07CiAgICBpbnQgbiwgcCwgaSwgajsKICAgIGNpbiA+PiBuOwogICAgZm9yKGludCBpPTE7aTw9bjtpKyspCiAgICB7CiAgICAgICAgY2luID4+IHA7CiAgICAgICAgaiA9IGktMTsKICAgICAgICB3aGlsZShqPjAgJiYgcD5tW2pdKQogICAgICAgIAltW2orMV0gPSBtW2otLV07CiAgICAgICAgbVtqKzFdID0gcDsKICAgICAgICBjb3V0IDw8IGorMSA8PGVuZGw7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==