#include <bits/stdc++.h>
using namespace std;
struct pt {
  int x, y, z;
  int zz;
};
const int MAX = 1 << 19;
pt ps[MAX];
bool cmpzxy(const pt &a, const pt &b) { return a.z < b.z; }
bool cmpxyz(const pt &a, const pt &b) {
  if (a.x != b.x) {
    return a.x < b.x;
  }
  return a.z > b.z;
}
void pr(int i) { printf("(%d, %d, %d)", ps[i].x, ps[i].y, ps[i].z); }
int tree[MAX + 5];
int query(int l) {
  int ret = -1;
  while (l) {
    ret = max(ret, tree[l]);
    l -= l & -l;
  }
  return ret;
}
void update(int at, int val) {
  while (at < MAX) {
    tree[at] = max(tree[at], val);
    at += at & -at;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &ps[i].x);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &ps[i].y);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &ps[i].z);
  }
  sort(ps, ps + n, cmpzxy);
  int ng = 1;
  for (int i = 0; i < n; i++) {
    if (i > 0 && ps[i].z != ps[i - 1].z) {
      ng++;
    }
    ps[i].zz = ng;
  }
  sort(ps, ps + n, cmpxyz);
  int ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    int q = query(MAX - (ps[i].zz + 1));
    if (q > ps[i].y) {
      ans++;
    } else {
      update(MAX - ps[i].zz, ps[i].y);
    }
  }
  printf("%d\n", ans);
  return 0;
}
