#include <bits/stdc++.h>   using namespace std;   const int N = 3e5 + 5;   long long a[N];   struct t {     int lval, rval, mval;   } tr[N * 4];   int sign(long long x) {     if (x > 0) return 1;     if (x < 0) return -1;     return 0;   }   inline void cal(int cur, int l, int r) {     int m = (l + r) / 2;     int dcur = cur + cur, u = dcur, v = u + 1;     tr[cur].mval = max(tr[u].mval, tr[v].mval);     tr[cur].lval = tr[u].lval;     tr[cur].rval = tr[v].rval;     if (!(!a[m] || !a[m + 1] || sign(a[m]) < sign(a[m + 1]))) {       tr[cur].mval = max(tr[cur].mval, tr[u].rval + tr[v].lval);       if (tr[dcur].mval == m - l + 1) {         tr[cur].lval = tr[u].lval + tr[v].lval;       }       if (tr[dcur + 1].mval == r - m) {         tr[cur].rval = tr[v].rval + tr[u].rval;       }     }   }   void build(int pos, int l, int r) {     if (l == r) {       int x = !!a[l];       tr[pos].lval = tr[pos].rval = tr[pos].mval = x;       return;     }     int mid = (l + r) >> 1;     build(pos * 2, l, mid);     build(pos * 2 + 1, mid + 1, r);     cal(pos, l, r);   }   void update(int pos, int l, int r, int k, int d) {     int mid = (l + r) >> 1;     if (l == r) {       a[l] += d;       int x = !!a[l];       tr[pos].lval = tr[pos].rval = tr[pos].mval = x;       return;     } else {       int mid = (l + r) >> 1;       if (k <= mid)         update(pos * 2, l, mid, k, d);       else         update(pos * 2 + 1, mid + 1, r, k, d);       cal(pos, l, r);     }   }   int main() {     int u, v, n, i, m, l, r, d;     cin >> n;     cin >> u;     for (i = 1; i < n; ++i) scanf( %d , &v), a[i - 1] = v - u, u = v;     if (n > 1) build(1, 0, n - 2);     cin >> m;     while (m--) {       scanf( %d%d%d , &l, &r, &u);       if (n == 1) {         printf( 1 n );       } else {         if (l > 1) update(1, 0, n - 2, l - 2, u);         if (r < n) update(1, 0, n - 2, r - 1, -u);         printf( %d n , tr[1].mval + 1);       }     }   }   