#include <bits/stdc++.h>
using namespace std;
struct P {
  int x, y, z;
} a[500000 + 5];
bool cmpxyz(P a, P b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y > b.y;
}
int t[500000 + 5];
void add(int x, int v) {
  for (; x <= 500000; x += x & -x) t[x] = min(t[x], v);
}
int ask(int x) {
  int res = 0x3f3f3f3f;
  for (; x; x -= x & -x) res = min(res, t[x]);
  return res;
}
vector<int> vec;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].x), a[i].x = -a[i].x;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].y), a[i].y = -a[i].y;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i].z), a[i].z = -a[i].z;
  for (int i = 1; i <= n; i++) vec.push_back(a[i].y);
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  for (int i = 1; i <= n; i++)
    a[i].y = lower_bound(vec.begin(), vec.end(), a[i].y) - vec.begin() + 1;
  sort(a + 1, a + n + 1, cmpxyz);
  memset(t, 63, sizeof t);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int x = ask(a[i].y - 1);
    if (x < a[i].z) ans++;
    add(a[i].y, a[i].z);
  }
  printf("%d\n", ans);
  return 0;
}
