#include #include #include using namespace __gnu_pbds; using namespace std; typedef tree< pair, null_type, less>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; main() { ios::sync_with_stdio(0); cin.tie(0); int n; int sz=0; cin>>n; vector ans(n,0); ordered_set t; int x,y; for(int i=0;i>x>>y; ans[t.order_of_key({x,++sz})]++; t.insert({x,sz}); } for(int i=0;i