import java.util.*; import java.lang.*; import java.math.*; public class Main { int n; int[] bit; int sum(int i){ int s=bit[0]; for(int x=i;x>0;x-=(x&-x)) s+=bit[x]; return s; } void add(int i,int a){ if(i==0) return; for(int x=i;x<=n;x+=(x&-x)) bit[x]+=a; } void run(){ Scanner cin = new Scanner(System.in); n = cin.nextInt(); int[] p = new int[n]; for(int i=0;i