#include <bits/stdc++.h>
using namespace std;
int n, ans;
struct node {
  int a, b, c;
} p[500005];
map<int, int> mp;
map<int, int>::iterator it;
inline char nc() {
  static char buf[1000001], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  register int s = 0;
  register char c = nc();
  while (c < '0' || c > '9') c = nc();
  while (c >= '0' && c <= '9') s = (s << 1) + (s << 3) + c - 48, c = nc();
  return s;
}
inline bool cmp(const node x, const node y) {
  return x.a != y.a ? x.a < y.a : x.b != y.b ? x.b > y.b : x.c < y.c;
}
int main() {
  n = read();
  for (register int i = 1; i <= n; i++) p[i].a = read();
  for (register int i = 1; i <= n; i++) p[i].b = read();
  for (register int i = 1; i <= n; i++) p[i].c = read();
  sort(p + 1, p + n + 1, cmp);
  mp[1e9] = -1e9;
  mp[-1e9] = 1e9;
  for (register int i = n; i >= 1; i--) {
    it = mp.upper_bound(p[i].b);
    if (it->second > p[i].c)
      ans++;
    else {
      if (mp[p[i].b] < p[i].c) {
        mp[p[i].b] = p[i].c;
        for (it = --mp.lower_bound(p[i].b); it->second < p[i].c;)
          mp.erase(it--);
      }
    }
  }
  printf("%d", ans);
  return 0;
}
