#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(N);
  vector<int> d(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];
  }
  int count = 0;
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (N); j++) {
      if (c[i] - a[j] > 0) {
        if (d[i] - b[j] > 0) {
          count++;
          c[i] = -1;
          a[j] = 2 * N;
          d[i] = -1;
          b[j] = 2 * N;
        }
      }
    }
  }
  cout << (count) << "\n";
  return 0;
}
