func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, dp[500005];   pair<int, int> p[500005];   int main() {     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %d%d , &p[i].first, &p[i].second);     sort(p, p + n);     for (int i = 0; i < n; ++i) {       if (i) dp[i] = max(dp[i], dp[i - 1]);       int ub = upper_bound(p + i + 1, p + n, make_pair(p[i].second + 1, 0)) - p;       dp[ub] = max(dp[ub], dp[i] + 1);     }     printf( %d n , max(dp[n], dp[n - 1]));   }   