#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e9 + 5;
const int MIN = -1;
struct girl {
  int b, i, r;
  bool operator>(const girl& g) const {
    if (b == g.b) {
      return i < g.i;
    }
    return b > g.b;
  }
};
int main() {
  int n;
  scanf("%d", &n);
  vector<girl> girls;
  girls.resize(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &girls[i].b);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &girls[i].i);
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &girls[i].r);
  }
  sort(girls.begin(), girls.end(), greater<girl>());
  map<int, int> s;
  map<int, int>::iterator it;
  s[MAX] = MIN;
  s[MIN] = MAX;
  int count = 0;
  for (int i = 0; i < n; i++) {
    it = s.upper_bound(girls[i].i);
    if (it->second > girls[i].r) {
      count++;
    } else if (it->second < girls[i].r) {
      if (girls[i].r > s[girls[i].i]) {
        s[girls[i].i] = girls[i].r;
        it = s.lower_bound(girls[i].i);
        it--;
        while (it->first != MIN) {
          if (it->second < girls[i].r) {
            s.erase(it);
          } else {
            break;
          }
          it = s.lower_bound(girls[i].i);
          it--;
        }
      }
    }
  }
  printf("%d\n", count);
}
