import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto n = readln.chomp.to!int;
  auto red = new int[][](n, 2);
  foreach (i; 0..n) {
    red[i] = readln.chomp.split.to!(int[]);
  }
  auto blue = new int[][](n, 2);
  foreach (i; 0..n) {
    blue[i] = readln.chomp.split.to!(int[]);
  }
  
  auto f = new bool[](n);

  
  int calc(int index, int cnt) {
    if (index == n + 1) return cnt;
    int res = cnt;
    foreach (i; 0..n) {
      if (f[i]) continue;
      int tmp;
      if (red[index][0] < blue[i][0] && red[index][1] < blue[i][1]) {
        tmp = 1;
      }
      f[i] = true;
      res = max(calc(index + 1, cnt + tmp), res);
      f[i] = false;
    }

    return res;
  }
  

  calc(0, 0).writeln;
}
