program ideone;
Const smax = 99;
Type simple = array[0..smax] of smallint;
Var data, sort, res:simple; i, n:smallint;
procedure writeArr(arr:simple; n:smallint);
Var i:smallint;
begin
for i:=0 to n do write(arr[i], ' ');
writeln();
end;
procedure delInArr(Var arr:simple; pos:smallint);
Var i:smallint; tArr:simple;
begin
for i:=0 to pos-1 do tArr[i]:=arr[i];
for i:=pos to smax do tArr[i]:=arr[i+1];
arr:=tArr;
end;
procedure insInArr(Var arr:simple; pos, e:smallint);
Var i:smallint; tArr:simple;
begin
for i:=0 to pos-1 do tArr[i]:=arr[i];
tArr[pos]:=e;
for i:=pos+1 to smax do tArr[i]:=arr[i+1];
arr:=tArr;
end;
function bubbleSort(arr:simple; n:smallint):simple;
Var i, j, t:smallint;
begin
for i:=0 to n-1 do
for j:=i to n-1 do
if arr[j]<arr[j+1] then begin
t:=arr[j];
arr[j]:=arr[j+1];
arr[j+1]:=t;
end;
bubbleSort:=arr;
end;
function converter(mainA:simple):simple;
Var i, j, max:smallint; res:simple;
begin
for i:=0 to n do begin
writeArr(mainA, n);
writeArr(res, n);
max:=0;
for j:=0 to n-i do if mainA[max]<mainA[j] then max:=j;
res[max]:=i+1;
delInArr(mainA, max);
end;
converter:=res;
end;
begin
read(n);
n:=n-1;
for i:=0 to n do read(data[i]);
sort:=bubbleSort(data, n);
res:=converter(data);
writeArr(res, n);
end.
cHJvZ3JhbSBpZGVvbmU7CgpDb25zdCBzbWF4ID0gOTk7ClR5cGUgc2ltcGxlID0gYXJyYXlbMC4uc21heF0gb2Ygc21hbGxpbnQ7ClZhciBkYXRhLCBzb3J0LCByZXM6c2ltcGxlOyBpLCBuOnNtYWxsaW50OwoKcHJvY2VkdXJlIHdyaXRlQXJyKGFycjpzaW1wbGU7IG46c21hbGxpbnQpOwpWYXIgaTpzbWFsbGludDsKYmVnaW4KCWZvciBpOj0wIHRvIG4gZG8gd3JpdGUoYXJyW2ldLCAnICcpOwoJd3JpdGVsbigpOwplbmQ7Cgpwcm9jZWR1cmU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