using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC091C_2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            int[] A = new int[N];
            int[] B = new int[N];
            int[] C = new int[N];
            int[] D = new int[N];
            for (int i = 0; i < N; i++)
            {
                var input = ReadInt();
                A[i] = input[0];
                B[i] = input[1];
            }
            for (int i = 0; i < N; i++)
            {
                var input = ReadInt();
                C[i] = input[0];
                D[i] = input[1];
            }

            FordFulkerson fd = new FordFulkerson(2 * N + 2);
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (A[i] < C[j] && B[i] < D[j]) fd.AddEdge(i + 2, j + N + 2, 1);
                }
            }
            for (int i = 0; i < N; i++)
            {
                fd.AddEdge(0, i + 2, 1);
            }
            for (int i = 0; i < N; i++)
            {
                fd.AddEdge(N + i + 2, 1, 1);
            }

            var ans = fd.MaxFlow(0, 1);

            Console.WriteLine(ans);
            Console.ReadKey();
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }  /// <summary>
       /// 最大流　容量に注意
       /// </summary>
    class FordFulkerson
    {
        public struct Edge
        {
            public int to, cap, rev;
        }

        public List<Edge>[] G;
        bool[] used;
        int INF = 1000000009;

        public FordFulkerson(int V) //頂点数
        {
            G = new List<Edge>[V].Select(x => new List<Edge>()).ToArray();
            used = new bool[V];
        }

        public void AddEdge(int from, int to, int cap)
        {
            G[from].Add(new Edge() { to = to, cap = cap, rev = G[to].Count });
            G[to].Add(new Edge() { to = from, cap = 0, rev = G[from].Count - 1 });
        }

        int Dfs(int v, int t, int f)
        {
            if (v == t)
                return f;
            used[v] = true;

            for (int i = 0; i < G[v].Count; i++)
            {
                var e = G[v][i];
                if (!used[e.to] && e.cap > 0)
                {
                    int d = Dfs(e.to, t, Math.Min(f, e.cap));
                    if (d > 0)
                    {
                        e.cap -= d;
                        G[v][i] = e;

                        var temp = G[e.to][e.rev];
                        temp.cap += d;
                        G[e.to][e.rev] = temp;

                        return d;
                    }
                }
            }
            return 0;
        }

        public int MaxFlow(int s, int t)
        {
            int flow = 0;
            while (true)
            {
                used = new bool[used.Length];
                int f = Dfs(s, t, INF);
                if (f == 0) return flow;
                flow += f;
            }
        }
    }
}


Measured memory_bytes: 13524