#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    FOREACH(x, v) { cout << x << " "; }                                        \
    cout << "\n";

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N;
vector<PL> red, blue;
struct edge {
    ll to, cap, rev;
};

vector<vector<edge>> G;
vector<bool> used;

void add_edge(ll from, ll to, ll cap) {
    G[from].push_back({to, cap, G[to].size()});
    G[to].push_back({from, 0, G[from].size() - 1});
}

ll dfs(ll v, ll t, ll f) {
    if(v == t) return f;
    used[v] = true;
    REP(i, G[v].size()) {
        edge &e = G[v][i];
        if(!used[e.to] && e.cap > 0) {
            ll 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;
}

ll max_flow(ll s, ll t) {
    ll flow = 0;
    while(1) {
        fill(All(used), false);
        ll f = dfs(s, t, LINF);
        if(f == 0) return flow;
        flow += f;
    }
}

int main() {
    cin >> N;
    G.resize(2 * N + 2);
    used.resize(2 * N + 2);
    REP(i, N) red.emplace_back(IN(), IN());
    REP(i, N) blue.emplace_back(IN(), IN());
    REP(i, N) REP(j, N) {
        if(red[i].first < blue[j].first && red[i].second < blue[j].second) {
            add_edge(i + 1, N + j + 1, 1);
        }
    }
    REP(i, N) add_edge(0, i + 1, 1);
    REP(i, N) add_edge(N + i + 1, 2 * N + 1, 1);
    cout << max_flow(0, 2 * N + 1) << "\n";
}

Measured memory_bytes: 512