func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 200005;   int n, m, nx, ny;   int A[N], B[N], C[N], D[N], X[N], Y[N], vis[N];   int ans = 1;   set<int> s[N << 2];   vector<int> e[N];   struct ST {     int mx, mn;   } tr[N << 2];   void upd(int p, int l, int r) {     int ls = p << 1, rs = p << 1 | 1;     if (l == r)       tr[p] = {0, 0};     else       tr[p] = ST{max(tr[ls].mx, tr[rs].mx), min(tr[ls].mn, tr[rs].mn)};     if (s[p].size()) {       int x = *s[p].rbegin();       if (vis[x])         tr[p].mn = max(tr[p].mn, x);       else         tr[p].mx = max(tr[p].mx, x);     }     if (tr[p].mx < tr[p].mn) tr[p].mx = 0;   }   void mdf(int p, int l, int r, int L, int R, int d) {     if (L > r || R < l) return;     if (L <= l && r <= R) {       if (d > 0)         s[p].insert(d);       else         s[p].erase(-d);       upd(p, l, r);       return;     }     int mid = l + r >> 1, ls = p << 1, rs = p << 1 | 1;     mdf(ls, l, mid, L, R, d);     mdf(rs, mid + 1, r, L, R, d);     upd(p, l, r);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d%d%d , &A[i], &B[i], &C[i], &D[i]);       X[++nx] = A[i], X[++nx] = C[i];       Y[++ny] = B[i], Y[++ny] = D[i];     }     sort(X + 1, X + nx + 1);     sort(Y + 1, Y + ny + 1);     nx = unique(X + 1, X + nx + 1) - X - 1;     ny = unique(Y + 1, Y + ny + 1) - Y - 1;     for (int i = 1; i <= n; i++) {       A[i] = lower_bound(X + 1, X + nx + 1, A[i]) - X;       B[i] = lower_bound(Y + 1, Y + ny + 1, B[i]) - Y;       C[i] = lower_bound(X + 1, X + nx + 1, C[i]) - X;       D[i] = lower_bound(Y + 1, Y + ny + 1, D[i]) - Y - 1;       e[A[i]].push_back(i);       e[C[i]].push_back(-i);     }     for (int i = 1, x; i <= nx; i++) {       for (int t : e[i]) x = abs(t), mdf(1, 1, ny, B[x], D[x], t);       for (; x = tr[1].mx; mdf(1, 1, ny, B[x], D[x], 0)) vis[x] = 1, ans++;     }     printf( %d n , ans);   }   