#include <bits/stdc++.h>
using namespace std;
struct Lady {
  long long int B;
  long long int I;
  long long int R;
};
class Fenwick {
  vector<long long int> tree;
  unsigned int n;

 public:
  Fenwick(unsigned int n_) {
    n = n_;
    tree.resize(1 + n);
  }
  void update(int k, long long int x) {
    for (; k < tree.size(); k += k & -k) ++tree[k] = max(x, tree[k]);
  }
  int query(int k) {
    long long int s = 0;
    for (; k > 0; k -= k & -k) s = max(tree[k], s);
    return s;
  }
};
auto compareI = [](Lady const &one, Lady const &two) { return one.I > two.I; };
auto compareB = [](Lady const &one, Lady const &two) {
  if (one.B == two.B) return one.I > two.I;
  return one.B > two.B;
};
int main() {
  ios::sync_with_stdio(false);
  long long int N, B, I, R;
  cin >> N;
  vector<Lady> girls(N);
  for (int i = 0; i < N; ++i) {
    cin >> B;
    girls[i].B = B;
  }
  for (int i = 0; i < N; ++i) {
    cin >> I;
    girls[i].I = I;
  }
  for (int i = 0; i < N; ++i) {
    cin >> R;
    girls[i].R = R;
  }
  sort(girls.begin(), girls.end(), compareI);
  int descendingI = girls[0].I;
  girls[0].I = 1;
  for (int i = 1; i < girls.size(); ++i) {
    if (girls[i].I == descendingI) {
      girls[i].I = girls[i - 1].I;
    } else {
      descendingI = girls[i].I;
      girls[i].I = girls[i - 1].I + 1;
    }
  }
  sort(girls.begin(), girls.end(), compareB);
  Fenwick fenwick(N);
  unsigned int PSM = 0;
  for (int i = 0; i < girls.size(); ++i) {
    if (fenwick.query(girls[i].I - 1) > girls[i].R) ++PSM;
    fenwick.update(girls[i].I, girls[i].R);
  }
  cout << PSM << endl;
  return 0;
}
