using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public Data[] R, B;
        public bool[] Used;

        public void Run()
        {
            {
                N = Input.ReadInt();
                R = new Data[N];
                B = new Data[N];
                Used = new bool[N];
            }
            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                R[i] = new Data();
                R[i].Y = line[0];
                R[i].X = line[1];
            }


            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                B[i] = new Data();
                B[i].Y = line[0];
                B[i].X = line[1];
            }

            Array.Sort(B, Data.Compare);

            int ret = 0;
            for (int b = 0; b < N; b++)
            {
                int maxX = -1;
                int rr = -1;
                for (int r = 0; r < N; r++)
                {
                    if (R[r].Y < B[b].Y && R[r].X < B[b].X && !Used[r])
                        if (R[r].X > maxX)
                        {
                            maxX = R[r].X;
                            rr = r;
                        }
                }

                if (rr >= 0)
                {
                    Used[rr] = true;
                    ret++;

                    // Console.Error.WriteLine("R-{0} {1} {2} B-{3}, {4} {5}", rr, R[rr].Y, R[rr].X, b, B[b].Y, B[b].X);
                }
            }
            Console.WriteLine(ret);

        }
    }

    // libs ----------
    class Data
    {
        public int X;
        public int Y;

        public static int Compare(Data d1, Data d2)
        {
            int c = d1.Y.CompareTo(d2.Y);
            if (c != 0) return c;
            return d1.X.CompareTo(d2.X);
        }

    }

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13396