using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int N = cin.nextint;
        var F = new Ford_Fulkerson(2 * N + 2);
        var A = new pair[N + 1];
        var B = new pair[N + 1];
        for (int i = 1; i <= N; i++)
        {
            A[i] = new pair(cin.nextint, cin.nextint);
        }
        for (int i = 1; i <= N; i++)
        {
            B[i] = new pair(cin.nextint, cin.nextint);
        }
        for (int i = 1; i <= N; i++)
        {
            F.add_edge(0, i, 1);
            F.add_edge(i + N, 2 * N + 1, 1);
        }
        for (int i = 1; i <= N; i++)
        {
            for (int j = 1; j <= N; j++)
            {
                if (A[i].f < B[j].f && A[i].s < B[j].s)
                {
                    F.add_edge(i, j + N, 1);
                }
            }
        }
        WriteLine(F.max_flow(0, 2 * N + 1));
    }
    
}


class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T f;
    public U s;
    public Pair(T f, U s)
    {
        this.f = f;
        this.s = s;
    }
    public int CompareTo(Pair<T, U> a)
    {
        return f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);
    }
    public override string ToString()
    {
        return f + " " + s;
    }
}
class Ford_Fulkerson
{
    // 辺を表すクラス（行き先、容量、逆辺）
    class Edge_
    {
        public int to;
        public long cap;
        public int rev;
        public Edge_(int to, long cap, int rev)
        {
            this.to = to;
            this.cap = cap;
            this.rev = rev;
        }
    }
    public const long INF = long.MaxValue / 3;
    List<Edge_>[] G; // グラフの隣接リスト表現
    bool[] used;     // DFSですでに調べたかのフラグ
    public Ford_Fulkerson(int V)
    {
        G = new List<Edge_>[V];
        for (int i = 0; i < V; i++) G[i] = new List<Edge_>();
        used = new bool[V];
    }
    // fromからtoへ向かう容量capの辺をグラフに追加する
    public void add_edge(int from, int to, long cap)
    {
        G[from].Add(new Edge_(to, cap, G[to].Count));
        G[to].Add(new Edge_(from, 0, G[from].Count - 1));
    }
    //増加パスをDFSで探す
    long dfs(int v, int t, long f)
    {
        if (v == t) return f;
        used[v] = true;
        for (int i = 0; i < G[v].Count; i++)
        {
            Edge_ e = G[v][i];
            if (!used[e.to] && e.cap > 0)
            {
                long 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;
    }
    // sからtへの最大流を求める
    public long max_flow(int s, int t)
    {
        long flow = 0;
        while (true)
        {
            for (int i = 0; i < used.Length; i++) used[i] = false;
            long f = dfs(s, t, INF);
            if (f == 0) return flow;
            flow += f;
        }
    }
}
class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

Measured memory_bytes: 13268