#include <bits/stdc++.h>
#define ll long long 
using namespace std;

int main(){
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n; cin >> n;
int x[100010], y[100010], z[100010];
for ( int i = 0; i < n; i++ ){
    cin >> x[i];
}

for ( int j = 0; j < n; j++ ){
    cin >> y[j];
}
for ( int l = 0; l < n; l++ ){
    cin >> z[l];
}
ll br = 0;
for ( int i = 0; j < n; j++ ){
    for ( int j = 0; j < n; j++ ){\
        if ( x[i] == x[j] ){
            br++;
        }
    }
}
cout << br;
return 0;
}