#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> ab(N), cd(N);
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    ab[i] = make_pair(a, b);
  }
  for (int i = 0; i < N; i++) {
    int c, d;
    cin >> c >> d;
    cd[i] = make_pair(d, c);
  }
  sort(ab.begin(), ab.end());
  sort(cd.begin(), cd.end());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int rec = 101;
    for (int j = 0; j < N; j++) {
      if (ab[j].first < cd[i].second && ab[j].second < cd[i].first) {
        rec = j;
      }
    }
    if (rec > N - 1) {
      continue;
    } else {
      ans++;
      ab[rec] = make_pair(201, 201);
    }
  }
  cout << ans << endl;
}
