func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T a, T b) {     if (a == 0) return b;     return gcd(b % a, a);   }   template <typename T>   T pow(T a, T b, long long m) {     T ans = 1;     while (b > 0) {       if (b % 2 == 1) ans = (ans * a) % m;       b /= 2;       a = (a * a) % m;     }     return ans % m;   }   int bit[100005];   int n;   int a[100005];   int lis[100005];   void update(int x, int val) {     for (int i = x; i < 100005; i += (i & -i)) bit[i] = max(bit[i], val);   }   int read(int x) {     int res = 0;     for (int i = x; i; i -= (i & -i)) res = max(res, bit[i]);     return res;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n;     int ans = 0;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       lis[i] = read(a[i] - 1) + 1;       update(a[i], lis[i]);       ans = max(ans, lis[i]);     }     cout << ans;   }   