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

bool ps(Tuple!(int, int, ulong) a, Tuple!(int, int, ulong) b) {
  if (b[1] == a[1]) {
    return b[0] > a[0];
  }
  return b[1] > a[1];
}

void main() {
  int N = readln.chomp.to!(int);
  Tuple!(int, int)[] R, B;
  Tuple!(int, int)[] R_, B_;
  for (int i = 0; i < N; i++) {
    int[] a = readln.chomp.split.to!(int[]);
    R ~= tuple(a[0], a[1]);
    R_ ~= tuple(a[0], a[1]);
  }
  for (int i = 0; i < N; i++) {
    int[] a = readln.chomp.split.to!(int[]);
    B ~= tuple(a[0], a[1]);
  }
  R.sort;
  B.sort;

  int ans = 0;
  foreach(int i, Tuple!(int, int) a; R) {
    Tuple!(int, int, ulong)[] po;
    foreach(ulong j, ref Tuple!(int, int) b; B) {
      if (a[0] < b[0] && a[1] < b[1]) {
        po ~= tuple(b[0], b[1], j);
      }
    }
    if (po) {
      po.sort!(ps);
      B[po[0][2]] = tuple(0, 0);
      R[i] = tuple(int.max, int.max);
      ans++;
    }
  }

  writeln(ans);
}
