using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            //

            var N = GetInt();
            var dinic = new Dinic(2 * N + 2);


            List<Tuple<int, int>> R = new List<Tuple<int, int>>();
            List<Tuple<int, int>> B = new List<Tuple<int, int>>();
            for (int i = 0; i < N; i++)
            {
                var cin = GetIntArray();
                R.Add(new Tuple<int, int>(cin[0], cin[1]));
            }
            for (int i = 0; i < N; i++)
            {
                var cin = GetIntArray();
                B.Add(new Tuple<int, int>(cin[0], cin[1]));
            }

            for (int i = 0; i < N; i++)
            {
                dinic.AddEdge(2 * N, i, 1);
                dinic.AddEdge(i + N, 2 * N + 1, 1);
                for (int j = 0; j < R.Count(); j++)
                {
                    if (B[i].Item1 > R[j].Item1 && B[i].Item2 > R[j].Item2)
                    {
                        dinic.AddEdge(i, N+j, 1);
                    }
                }
            }
            var ans = dinic.MaxFlow(2 * N, 2 * N + 1);
            Console.WriteLine(ans);

            //
            Console.Out.Flush();
            Console.ReadKey();
        }

        static void Solve()
        {

        }

        class Dinic
        {
            public Dinic(int node_size)
            {
                V = node_size;
                G = new List<List<Edge>>();
                for(int i = 0; i < V; i++)
                {
                    G.Add(new List<Edge>());
                }
                level = Enumerable.Repeat(0, V).ToList();
                iter = Enumerable.Repeat(0, V).ToList();
            }

            List<List<Edge>> G;
            int V;
            List<int> level;
            List<int> iter;

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

            public int MaxFlow(int s, int t)
            {
                int flow = 0;
                while (true)
                {
                    BFS(s);
                    if (level[t] < 0) { return flow; }
                    iter = Enumerable.Repeat(0, V).ToList();
                    var f = DFS(s, t, 1000000007);
                    while (f > 0)
                    {
                        flow += f;
                        f = DFS(s, t, 1000000007);
                    }
                }
            }

            void BFS(int s)
            {
                level = Enumerable.Repeat(-1, V).ToList();
                level[s] = 0;
                var que = new Queue<int>();
                que.Enqueue(s);
                while (que.Count != 0)
                {
                    var v = que.Dequeue();
                    for (int i = 0; i < G[v].Count; i++)
                    {
                        var e = G[v][i];
                        if (e.Cap > 0 && level[e.To] < 0)
                        {
                            level[e.To] = level[v] + 1;
                            que.Enqueue(e.To);
                        }
                    }
                }
            }

            int DFS(int v, int t, int f)
            {
                if (v == t) return f;
                for (int i = iter[v]; i < G[v].Count; i++)
                {
                    iter[v] = i;
                    var e = G[v][i];
                    if (e.Cap > 0 && level[v] < level[e.To])
                    {
                        var d = DFS(e.To, t, Math.Min(f, e.Cap));
                        if (d > 0)
                        {
                            e.Cap -= d;
                            G[e.To][e.Rev].Cap += d;
                            return d;
                        }
                    }
                }
                return 0;
            }

            class Edge
            {
                public Edge(int to, int cap, int rev)
                {
                    To = to;
                    Cap = cap;
                    Rev = rev;
                }
                public int To { get; set; }
                public int Cap;
                public int Rev { get; set; }
            }
        }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

Measured memory_bytes: 13780