#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > red(n), blue(n);
  for (int(i) = 0; (i) < (n); (i)++) cin >> red[i].first >> blue[i].second;
  for (int(i) = 0; (i) < (n); (i)++) cin >> blue[i].first >> blue[i].second;
  vector<bool> used(n, true);
  int ans = 0;
  sort(red.begin(), red.end());
  sort(blue.begin(), blue.end());
  for (int i = 0; i < n; ++i) {
    int tmp = -1;
    int minindex;
    for (int j = 0; j < n; ++j) {
      if (red[j].first < blue[i].first && red[j].second < blue[i].second &&
          used[j]) {
        if (red[j].second > tmp) {
          tmp = red[j].second;
          minindex = j;
        }
      }
    }
    if (tmp != -1) {
      used[minindex] = false;
      ans++;
    }
  }
  cout << ans << endl;
}
