#include <bits/stdc++.h>   using namespace std;   int n, a[2 * 100004], b[2 * 100004], c[2 * 100004], poz, x;   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       c[a[i]] = 1;     }     poz = 1;     for (int i = 1; i <= n; ++i) {       cin >> b[i];       if (c[b[i]] == 0) {         cout <<  0  ;         continue;       }       for (int j = poz; j <= n; ++j) {         c[a[j]] = 0;         if (a[j] == b[i]) {           cout << j - poz + 1 <<    ;           poz = j + 1;           break;         }       }     }     return 0;   }   