func_code_string: #include <bits/stdc++.h>   using namespace std;   int conv[1000000];   int a[1000000];   int b[1000000];   int n;   int best = 0;   int d[1000000];   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];       a[i]--;     }     for (int i = 0; i < n; i++) {       cin >> b[i];       b[i]--;     }     for (int i = 0; i < n; i++) {       conv[a[i]] = i;     }     for (int i = 0; i < n; i++) {       b[i] = conv[b[i]];     }     reverse(b, b + n);     for (int i = 0; i < n; i++) {       int l = -1;       int r = best;       while (r - l > 1) {         int mid = (r + l) >> 1;         if (d[mid] > b[i]) {           r = mid;         } else {           l = mid;         }       }       if (r == best) {         d[best++] = b[i];       } else {         d[r] = b[i];       }     }     cout << best;     return 0;   }   