// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

template <typename T>
struct Edge {
    int to; T cap, cost; int rev;
    Edge(int t, T c, int r) : to(t), cap(c), rev(r) {}
    Edge(int t, T ca, T co, int r) : to(t), cap(ca), cost(co), rev(r) {}
};

template <typename T>
using Graph = vector< vector< Edge<T> > >;

struct BipartiteMatching {
    int S, T, E, a, b;
    vector< vector< Edge<int> > > G;
    vector<int> used;
    BipartiteMatching(int x, int y, int z) : S(x), T(y), E(z) {
        G.resize(S+T+2);
        used.resize(S+T+2);
        a = S + T, b = a + 1;
    }
    void add_edge(int from, int to, int cap) {
        G[from].push_back(Edge<int>(to  , cap, G[to  ].size()    ));
        G[to  ].push_back(Edge<int>(from, 0  , G[from].size() - 1));
    }
    void readGraph() {
        for(int i=0; i<E; i++) {
            int x, y; cin >> x >> y;
            // x--; y--;
            add_edge(x, y+S, 1);
        }
        for(int i=0; i<S; i++) add_edge(a  , i, 1);
        for(int i=0; i<T; i++) add_edge(i+S, b, 1);
    }
    int dfs(int v, int t, int f) {
        if(v == t) return f;
        used[v] = true;
        for(size_t i=0; i<G[v].size(); i++) {
            Edge<int> &e = G[v][i];
            if(!used[e.to] && e.cap > 0) {
                int d = dfs(e.to, t, min(f, e.cap));
                if(d > 0) {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }
    int solve() {
        int flow = 0;
        while(1) {
            fill(used.begin(), used.end(), 0);
            int f = dfs(a, b, INF);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int a[110], b[110], c[110], d[110];
signed main() {
    int N; cin >> N;
    rep(i,0,N) {
        cin >> a[i] >> b[i];
    }
    rep(i,0,N) {
        cin >> c[i] >> d[i];
    }

    BipartiteMatching fl(N, N, 0);
    int source = 2*N, sink = source + 1;
    rep(i,0,N) {
        fl.add_edge(source, i, 1);
        fl.add_edge(N+i, sink, 1);
    }
    rep(i,0,N) rep(j,0,N) {
        bool ba = (a[i] < c[j]);
        bool bb = (b[i] < d[j]);
        if(ba && bb) {
            // printf("edge: %lld -> %lld\n", i, j);
            fl.add_edge(i, N+j, 1);
        }
    }
    cout << fl.solve() << endl;
    return 0;
}

Measured memory_bytes: 512