#include #include using namespace std; using namespace atcoder; using ll = long long; using S = pair; using F = ll; F ID = -1; S op(S a, S b){ return {a.first + b.first, a.second + b.second}; } S e(){ return {0, 0}; } S mapping(F f, S x){ if (f == ID) return x; else return {x.second*f, x.second}; } F composition(F f, F g){ if (f == ID) return g; else return f; } F id() {return ID;} template void compress(vector &A){ map comp; int N = A.size(), i=0; for (int i=0; i> N; vector H(N+1), A; vector v; H[0] = 1; for (int i=1; i<=N; i++) cin >> H[i]; A = H; compress(H); sort(A.begin(), A.end()); A.erase(unique(A.begin(), A.end()), A.end()); for (int i=0; i tree(v); for (int i=1; i<=N; i++){ if (i % 2 == 1) tree.apply(0, H[i]+1, 1); else tree.apply(0, H[i]+1, 0); cout << tree.all_prod().first << endl; } return 0; }