#include <bits/stdc++.h>
using namespace std;
struct Lady {
  int x, y, z;
  Lady() {}
  Lady(int x, int y, int z) : x(x), y(y), z(z) {}
  bool operator<(const Lady &rhs) const {
    if (x == rhs.x) {
      if (y == rhs.y) return z < rhs.z;
      return y < rhs.y;
    }
    return x < rhs.x;
  }
};
struct CmpX {
  bool operator()(const Lady &a, const Lady &b) const { return a.x < b.x; }
};
struct CmpY {
  bool operator()(const Lady &a, const Lady &b) const { return a.y < b.y; }
};
struct CmpZ {
  bool operator()(const Lady &a, const Lady &b) const { return a.z < b.z; }
};
struct KD {
  struct Node {
    Lady *p;
    Node *l, *r;
    Node(Lady *p) : p(p), l(NULL), r(NULL) {}
  } * root;
  KD() : root(NULL) {}
  void build(Lady p[], int n) { root = build(p, n, 0); }
  Node *build(Lady p[], int n, int d) {
    if (n == 0) return NULL;
    if (n == 1) return new Node(p);
    if (d == 0)
      sort(p, p + n, CmpX());
    else if (d == 1)
      sort(p, p + n, CmpY());
    else if (d == 2)
      sort(p, p + n, CmpZ());
    Node *ret = new Node(p + n / 2);
    ret->l = build(p, n / 2, (d + 1) % 3);
    ret->r = build(p + n / 2 + 1, n - n / 2 - 1, (d + 1) % 3);
    return ret;
  }
  bool search(const Lady *p1) { return search(root, 0, p1); }
  bool search(const Node *t, int d, const Lady *p0) {
    if (t == NULL) return false;
    if (t->p->x >= p0->x && t->p->y >= p0->y && t->p->z >= p0->z) return true;
    bool ret = false;
    if (d == 0) {
      if (t->p->x >= p0->x)
        if (search(t->l, (d + 1) % 3, p0)) return true;
    } else if (d == 1) {
      if (t->p->y >= p0->y)
        if (search(t->l, (d + 1) % 3, p0)) return true;
    } else if (d == 2) {
      if (t->p->z >= p0->z)
        if (search(t->l, (d + 1) % 3, p0)) return true;
    }
    if (search(t->r, (d + 1) % 3, p0)) return true;
    return false;
  }
};
Lady lady[500000];
int main() {
  KD kdt;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) scanf("%d", &lady[i].x);
  for (int i = 0; i < (int)(n); i++) scanf("%d", &lady[i].y);
  for (int i = 0; i < (int)(n); i++) scanf("%d", &lady[i].z);
  kdt.build(lady, n);
  int ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    Lady p0(lady[i].x + 1, lady[i].y + 1, lady[i].z + 1);
    ans += kdt.search(&p0);
  }
  printf("%d\n", ans);
  return 0;
}
