// 確認用、クソコード。
using System;
using System.Linq;
public class Program {
  public static void Main() {
    int N = int.Parse(Console.ReadLine());
    int[][] red = new int[N][];
    int[][] blue = new int[N][];
    for (int i = 0; i < N; i++) red[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    for (int i = 0; i < N; i++) blue[i] = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    red1 = red.OrderByDescending(x => x[0]).ThenByDescending(x => x[1]).ToArray();
    blue1 = blue.OrderByDescending(x => x[0]).ThenByDescending(x => x[1]).ToArray();
    red2 = red.OrderByDescending(x => x[1]).ThenByDescending(x => x[0]).ToArray();
    blue2 = blue.OrderByDescending(x => x[1]).ThenByDescending(x => x[0]).ToArray();

    int count1 = 0, count2 = 0;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (blue1[j] != null) {
          if (red1[i][0] < blue1[j][0] && red1[i][1] < blue1[j][1]) {
            //Console.WriteLine("1: ({0},{1}) & ({2},{3})", red1[i][0], red1[i][1], blue1[j][0], blue1[j][1]); // debug!
            count1++;
            blue1[j] = null;
            break;
          }
        }
        if (blue2[j] != null) {
          if (red2[i][0] < blue2[j][0] && red2[i][1] < blue2[j][1]) {
            //Console.WriteLine("2: ({0},{1}) & ({2},{3})", red2[i][0], red2[i][1], blue2[j][0], blue2[j][1]); // debug!
            count2++;
            blue2[j] = null;
            break;
          }
        }
      }
    }
    Console.WriteLine(Math.Max(count1, count2));
  }
}
