#include <bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<queue>
#include<cmath>
#define TS printf("!!!\n")
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 205; //点数的最大值
const int MAXM = 10500; //边数的最大值
int x[MAXN], y[MAXN];
struct Node
{
        int from, to, next;
        int cap;
} edge[MAXM];
int tol;

int dep[MAXN];//dep为点的层次
int head[MAXN];

int n;
void init()
{
        tol = 0;
        memset(head, -1, sizeof(head));
}
void addedge(int u, int v, int w) //第一条变下标必须为偶数
{
        edge[tol].from = u;
        edge[tol].to = v;
        edge[tol].cap = w;
        edge[tol].next = head[u];
        head[u] = tol++;
        edge[tol].from = v;
        edge[tol].to = u;
        edge[tol].cap = 0;
        edge[tol].next = head[v];
        head[v] = tol++;
}

int BFS(int start, int end)
{
        int que[MAXN];
        int front, rear;
        front = rear = 0;
        memset(dep, -1, sizeof(dep));
        que[rear++] = start;
        dep[start] = 0;
        while (front != rear)
        {
                int u = que[front++];
                if (front == MAXN)
                {
                        front = 0;
                }
                for (int i = head[u]; i != -1; i = edge[i].next)
                {
                        int v = edge[i].to;
                        if (edge[i].cap > 0 && dep[v] == -1)
                        {
                                dep[v] = dep[u] + 1;
                                que[rear++] = v;
                                if (rear >= MAXN)
                                {
                                        rear = 0;
                                }
                                if (v == end)
                                {
                                        return 1;
                                }
                        }
                }
        }
        return 0;
}
int dinic(int start, int end)
{
        int res = 0;
        int top;
        int stack[MAXN];//stack为栈，存储当前增广路
        int cur[MAXN];//存储当前点的后继
        while (BFS(start, end))
        {
                memcpy(cur, head, sizeof(head));
                int u = start;
                top = 0;
                while (1)
                {
                        if (u == end)
                        {
                                int min = INF;
                                int loc;
                                for (int i = 0; i < top; i++)
                                        if (min > edge[stack[i]].cap)
                                        {
                                                min = edge[stack[i]].cap;
                                                loc = i;
                                        }
                                for (int i = 0; i < top; i++)
                                {
                                        edge[stack[i]].cap -= min;
                                        edge[stack[i] ^ 1].cap += min;
                                }
                                res += min;
                                top = loc;
                                u = edge[stack[top]].from;
                        }
                        for (int i = cur[u]; i != -1; cur[u] = i = edge[i].next)
                                if (edge[i].cap != 0 && dep[u] + 1 == dep[edge[i].to])
                                {
                                        break;
                                }
                        if (cur[u] != -1)
                        {
                                stack[top++] = cur[u];
                                u = edge[cur[u]].to;
                        }
                        else
                        {
                                if (top == 0)
                                {
                                        break;
                                }
                                dep[u] = -1;
                                u = edge[stack[--top]].from;
                        }
                }
        }
        return res;
}

int main()
{
        int n;
        cin >> n;
        init();
        for (int i = 1; i <= n; i++)
        {
                cin >> x[i] >> y[i];
        }
        for (int i = 1; i <= n; i++)
        {
                addedge(0, i, 1), addedge(i + n, 2 * n + 1, 1);
        }
        for (int i = 1; i <= n; i++)
        {
                int idx, idy;
                cin >> idx >> idy;
                for (int j = 1; j <= n; j++)
                {
                        if (idx > x[j] && idy > y[j])
                        {
                                addedge(j, i + n, 1);
                        }
                }
        }
        int st, tp;
        st = 0, tp = 2 * n + 1;
        cout << dinic(st, tp);
}


Measured memory_bytes: 384