import std.stdio,
       std.string,
       std.conv,
       std.algorithm,
       std.typecons,
       std.container;

void main() {
  int N = readln.chomp.to!int;
  Tuple!(int, int, bool)[] L;
  for (int i = 0; i < N; i++) {
    auto a = readln.chomp.split.to!(int[]);
    L ~= tuple(a[0], a[1], false);
  }
  for (int i = 0; i < N; i++) {
    auto a = readln.chomp.split.to!(int[]);
    L ~= tuple(a[0], a[1], true);
  }

  L.sort;

  auto s = new RedBlackTree!(Tuple!(int, int, bool));
  int ans;
  for (int i = 0; i < N * 2; i++) {
    if (L[i][2]) {
      Tuple!(int, int, bool) ma = tuple(int.min, int.min, false);
      bool f = false;
      foreach (Tuple!(int, int, bool) e; s) {
        if (L[i][0] > e[0] && L[i][1] > e[1]) {
          if (ma[1] < e[1]) {
            ma = tuple(e[0], e[1], false);
            f = true;
          }
        }
      }
      if (f) {
        s.removeKey(ma);
        ans++;
      }
    }
    else {
      s.insert(L[i]);
    }
  }

  writeln(ans);
}
