#include #include typedef long long LL; const int maxn=500005; int n,a[maxn],b[maxn]; LL tot; void GB(int *a,int *b,int len) { if(len<=1) return; int M=len/2,p1=0,p2=M,p=0; GB(a,b,M); GB(a+M,b+M,len-M); while(p1