#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v, d;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    v.push_back(make_pair(x, y));
  }
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    d.push_back(make_pair(x, y));
  }
  int sum = 0;
  int y[10000] = {};
  sort(v.begin(), v.end());
  sort(d.begin(), d.end());
  for (int i = n - 1; i >= 0; i--) {
    int j = n - 1;
    int o = j;
    while (v[j].first > d[i].first || v[j].second > d[i].second && j >= 0 ||
           y[j] == -1) {
      j--;
      if (y[j] != -1) o = j;
    }
    if (v[o].first < d[i].first && v[o].second < d[i].second && j >= 0 &&
        y[o] != -1) {
      sum++;
      y[o] = -1;
    }
  }
  cout << sum;
  return 0;
}
