#include <bits/stdc++.h>
using namespace std;
const int maxn = 500010;
int n, h[maxn];
struct lady {
  int B, I, R;
} ladies[maxn];
int cmp(lady a, lady b) { return (a.B == b.B && a.I < b.I) || (a.B > b.B); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &ladies[i].B);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &ladies[i].I), h[i] = ladies[i].I;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &ladies[i].R);
  }
  sort(ladies, ladies + n, cmp);
  sort(h, h + n);
  for (int i = 0; i < n; i++) {
    ladies[i].I = n - (lower_bound(h, h + n, ladies[i].I) - h);
  }
  memset(h, 0, sizeof(h));
  int kills = 0;
  for (int i = 0; i < n; i++) {
    int tmp = 0;
    for (int j = ladies[i].I - 1; j; j -= j & -j) tmp = max(tmp, h[j]);
    if (tmp > ladies[i].R) kills++;
    for (int j = ladies[i].I; j <= n; j += j & -j)
      h[j] = max(h[j], ladies[i].R);
  }
  printf("%d\n", kills);
  return 0;
}
