#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count = 0;
  bool n_ch[101] = {false};
  pair<int, int> ab[101];
  pair<int, int> cd[101];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ab[i].second >> ab[i].first;
  }
  for (int i = 0; i < n; i++) {
    cin >> cd[i].first >> cd[i].second;
  }

  sort(ab, ab + n);
  reverse(ab, ab + n);
  sort(cd, cd + n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (ab[i].first < cd[j].second && ab[i].second < cd[j].first && n_ch[j] == false) {
        n_ch[j] = true;
        count++;
        break;
      }
      
    }
  }
  cout << count << endl;
}