#include #include #include #include #include #include using namespace std; using ll = long long; template< typename T > struct BIT2D{ int H,W; vector> data; BIT2D(int h,int w):H(h),W(w),data(h+1,vector(w+1,0)){} void add(int h,int w,T x){ h++;w++; for(int i = h;i<=H;i+=i&(-i)){ for(int j = w;j<=W;j+=j&(-j)){ data[i][j] += x; } } } //sum of [l,r) T sum(int h1,int w1,int h2,int w2){ return sum(h2,w2)-sum(h2,w1-1)-sum(h1-1,w2)+sum(h1-1,w1-1); } T sum(int h,int w){ h++;w++; T now = 0; for(int i = h;i>0;i-=i&(-i)){ for(int j = w;j>0;j-=j&(-j)){ now += data[i][j]; } } return now; } }; int main(){ int n; cin>>n; vector a(n); for(int i = 0;i>a[i]; ll ans = 0; vector>> u1(2001),u2(2001); for(int i = 0;i b(n+1,n+1); for(int i = 2000;i>=0;i--){ int want = i + 11; if(want<=2000){ for(int j = 0;j