#include <bits/stdc++.h>   using namespace std;   const int INF = int(1e9);   const int MOD = INF + 7;   const long long INFll = 1ll * INF * INF;   const long double ldINF = 1e+018;   const long double EPS = 0.000000001;   const int MAXN = 150;   const int N = 100001;   const int seg[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};   struct feature {     int b, i, r;   };   bool comp(feature x, feature y) {     return x.r > y.r || (x.r == y.r && x.b < y.b);   }   int t[1001000];   int cur = 0;   int query(int l, int r) {     int res = 0;     for (l += cur, r += cur; l < r; l >>= 1, r >>= 1) {       if (l & 1) res = max(res, t[l++]);       if (r & 1) res = max(res, t[--r]);     }     return res;   }   void modify(int p, int value) {     t[p += cur] = value;     while (p > 1) {       p >>= 1;       t[p] = max(t[p << 1], t[p << 1 | 1]);     }   }   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     vector<feature> v(n);     for (int i = 0; i < n; i++) cin >> v[i].r;     for (int i = 0; i < n; i++) cin >> v[i].b;     for (int i = 0; i < n; i++) cin >> v[i].i;     vector<int> b;     for (int i = 0; i < n; i++) b.push_back(v[i].b);     sort(b.begin(), b.end());     map<int, int> m;     m[b[0]] = 0;     for (int i = 1; i < n; i++)       if (b[i] != b[i - 1]) m[b[i]] = ++cur;     cur++;     for (int i = 0; i < n; i++) v[i].b = m[v[i].b];     int ans = 0;     sort(v.begin(), v.end(), comp);     for (int i = 0; i < n; i++) {       int d = query(v[i].b + 1, cur);       if (d > v[i].i) {         ans++;       }       modify(v[i].b, max(t[v[i].b + cur], v[i].i));     }     cout << ans << endl;     return 0;   }   