#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n;
int a[500], b[500], c[500], d[500];
vector<int> g[500];
bool bpm(int u, bool seen[], int matchR[]) {
  for (auto v : g[u]) {
    if (!seen[v]) {
      seen[v] = true;
      if (matchR[v] < 0 || bpm(matchR[v], seen, matchR)) {
        matchR[v] = u;
        return true;
      }
    }
  }
  return false;
}
int maxBPM() {
  int matchR[N];
  memset(matchR, -1, sizeof(matchR));
  int result = 0;
  for (int u = 0; u < n; u++) {
    bool seen[N];
    memset(seen, 0, sizeof(seen));
    if (bpm(u, seen, matchR)) result++;
  }
  return result;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> c[i] >> d[i];
    for (int j = 0; j < n; ++j) {
      if (a[j] < c[i] && b[j] < d[i]) g[i].push_back(j);
    }
  }
  cout << maxBPM();
  return 0;
}
