#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > r(n), b(n);
  for (int i = 0; i < n; i++) cin >> r[i].first >> r[i].second;
  for (int i = 0; i < n; i++) cin >> b[i].first >> b[i].second;
  sort(b.begin(), b.end());
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int tmp = -1;
    for (int j = 0; j < n; j++) {
      if (r[j].first < b[i].first && r[j].second < b[i].second) {
        if (tmp == -1)
          tmp = j;
        else if (r[j].second > r[tmp].second)
          tmp = j;
      }
    }
    if (tmp != -1) {
      r[tmp].second = n * 2;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
