#include <bits/stdc++.h>
using namespace std;
typedef long long ll; typedef pair< int, int > pair_t;
const int N = 50000; ll elapsed_time[ N + 1 ];
struct pending_tasks_t: vector< int >
{
int order( int i )
{
return lower_bound( begin(), end(), i ) - begin();
}
void remove_task( int i )
{
erase( lower_bound( begin(), end(), i ) );
}
};
int main()
{
int n; cin >> n; vector< pair_t > task; pending_tasks_t p; ll time = n;
for( int i = 1; i <= n; i++ )
{
int t; cin >> t;
if ( t == 1 )
elapsed_time[ i ] = i;
else
task.emplace_back( t, i ), p.push_back( i );
}
sort( task.begin(), task.end() );
for( int i = 0, it = 2, k = 0, m = task.size(), remaining = m, t; i < m; i += k, it = t + 1, k = 0 )
{
time += ( ( t = task[ i ].first ) - it ) * ll( remaining ) + 1;
for( int j = i, q; j < m and task[ j ].first == t; j++, k++ )
q = task[ j ].second, elapsed_time[ q ] = time + p.order( q );
for( int j = 0; j < k; j++ )
p.remove_task( task[ i + j ].second );
time += remaining - 1, remaining -= k;
}
for( int i = 1; i <= n;i++ )
cout << elapsed_time[ i ] << '\n';
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7IHR5cGVkZWYgcGFpcjwgaW50LCBpbnQgPiBwYWlyX3Q7Cgpjb25zdCBpbnQgTiA9IDUwMDAwOyBsbCBlbGFwc2VkX3RpbWVbIE4gKyAxIF07CgpzdHJ1Y3QgcGVuZGluZ190YXNrc190OiB2ZWN0b3I8IGludCA+CnsKICAgIGludCBvcmRlciggaW50IGkgKQogICAgewogICAgICAgIHJldHVybiBsb3dlcl9ib3VuZCggYmVnaW4oKSwgZW5kKCksIGkgKSAtIGJlZ2luKCk7CiAgICB9CgogICAgdm9pZCByZW1vdmVfdGFzayggaW50IGkgKQogICAgewogICAgICAgIGVyYXNlKCBsb3dlcl9ib3VuZCggYmVnaW4oKSwgZW5kKCksIGkgKSApOwogICAgfQp9OwoKaW50IG1haW4oKQp7CiAgICBpbnQgbjsgY2luID4+IG47IHZlY3RvcjwgcGFpcl90ID4gdGFzazsgcGVuZGluZ190YXNrc190IHA7IGxsIHRpbWUgPSBuOwoKICAgIGZvciggaW50IGkgPSAxOyBpIDw9IG47IGkrKyApCiAgICB7CiAgICAgICAgaW50IHQ7IGNpbiA+PiB0OwoKICAgICAgICBpZiAoIHQgPT0gMSApCiAgICAgICAgICAgIGVsYXBzZWRfdGltZVsgaSBdID0gaTsKICAgICAgICBlbHNlCiAgICAgICAgICAgIHRhc2suZW1wbGFjZV9iYWNrKCB0LCBpICksIHAucHVzaF9iYWNrKCBpICk7CiAgICB9CgogICAgc29ydCggdGFzay5iZWdpbigpLCB0YXNrLmVuZCgpICk7CgoJZm9yKCBpbnQgaSA9IDAsIGl0ID0gMiwgayA9IDAsIG0gPSB0YXNrLnNpemUoKSwgcmVtYWluaW5nID0gbSwgdDsgaSA8IG07IGkgKz0gaywgaXQgPSB0ICsgMSwgayA9IDAgKQogICAgewogICAgICAgIHRpbWUgKz0gKCAoIHQgPSB0YXNrWyBpIF0uZmlyc3QgKSAtIGl0ICkgKiBsbCggcmVtYWluaW5nICkgKyAxOwoKCQlmb3IoIGludCBqID0gaSwgcTsgaiA8IG0gYW5kIHRhc2tbIGogXS5maXJzdCA9PSB0OyBqKyssIGsrKyApCiAgICAgICAgICAgIHEgPSB0YXNrWyBqIF0uc2Vjb25kLCBlbGFwc2VkX3RpbWVbIHEgXSA9IHRpbWUgKyBwLm9yZGVyKCBxICk7CgoJCWZvciggaW50IGogPSAwOyBqIDwgazsgaisrICkKICAgICAgICAgICAgcC5yZW1vdmVfdGFzayggdGFza1sgaSArIGogXS5zZWNvbmQgKTsKCiAgICAgICAgdGltZSArPSByZW1haW5pbmcgLSAxLCByZW1haW5pbmcgLT0gazsKCX0KCglmb3IoIGludCBpID0gMTsgaSA8PSBuO2krKyApCgkJY291dCA8PCBlbGFwc2VkX3RpbWVbIGkgXSA8PCAnXG4nOwp9