#include<bits/stdc++.h>
using namespace std;

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end())
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct Setup {
    static constexpr int PREC = 20;
    Setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

struct BipartiteMatching {
    int n;
    std::vector<std::vector<int>> G;
    std::vector<int> match, used;
    int timestamp;
    BipartiteMatching(int n) : n(n), G(n), match(n), used(n) {}
    void addEdge(int u, int v) {
        G[u].push_back(v);
        G[v].push_back(u);
    }
    bool dfs(int v) {
        used[v] = timestamp;
        for (int i = 0; i < G[v].size(); i++) {
            int u = G[v][i], w = match[u];
            if (w < 0 || used[w] != timestamp && dfs(w)) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }
    std::vector<std::pair<int, int>> getMaxMatching() {
        fill(match.begin(), match.end(), -1);
        fill(used.begin(), used.end(), 0);
        timestamp = 0;
        for (int i = 0; i < n; i++) {
            if (match[i] < 0) {
                timestamp++;
                dfs(i);
            }
        }
        std::vector<std::pair<int, int>> ret;
        for (int i = 0; i < n; i++) {
            if (i < match[i]) { ret.push_back({i, match[i]}); }
        }
        return ret;
    }
};

int N;
int a[110], b[110], c[110], d[110];
signed main() {
    cin >> N;
    rep(i, N) { cin >> a[i] >> b[i]; }
    rep(i, N) { cin >> c[i] >> d[i]; }
    BipartiteMatching bm(N + N);
    rep(i, N) {
        rep(j, N) {
            if (a[i] < c[j] && b[i] < d[j]) { bm.addEdge(i, N + j); }
        }
    }
    cout << bm.getMaxMatching().size() << endl;
}

Measured memory_bytes: 384