#define lowbit(x) x&(-x)
int c[maxn];
int getsum(int x){
int ret = 0;
for( ; x > 0; ret += c[x], x -= lowbit(x));
return ret;
}
void update(int x, int val){
for ( ; x < maxn; c[x] += val, x += lowbit(x));
}
#define lowbit(x) x&(-x)
int c[maxn];
int getsum(int x){
int ret = 0;
for( ; x > 0; ret += c[x], x -= lowbit(x));
return ret;
}
void update(int x, int val){
for ( ; x < maxn; c[x] += val, x += lowbit(x));
}