import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int n;
Tuple! (int, int) [] u;
Tuple! (int, int) [] v;
int [] a;
int [] girls;
bool [] w;

bool go (int k) {
  if (w[k]) {
    return false;
  }
  w[k] = true;
  foreach (i; 0 .. n) {
    if (u[k][0] < v[i][0] && u[k][1] < v[i][1]) {
      if (girls[i] < 0 || go (girls[i])) {
        girls[i] = k;
        return true;
      }
    }
  }
  return false;
}

void main() {
  readf (" %d", &n);
  u = new Tuple! (int, int) [n];
  v = new Tuple! (int, int) [n];
  foreach (i; 0 .. n) {
    int x, y;
    readf (" %d %d", &x, &y);
    u[i] = tuple (x, y);
  }
  foreach (i; 0 .. n) {
    int x, y;
    readf (" %d %d", &x, &y);
    v[i] = tuple (x, y);
  }
  girls = new int[n];
  foreach (i; 0 .. n) {
    girls[i] = -1;
  }
  int res = 0;
  foreach (i; 0 .. n) {
    w = new bool[n];
    if (go (i)) {
      res++;
    }
  }
  writeln (res);
}
