#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, c, d;
  cin >> n;
  vector<pair<int, int>> red(n), blue(n);
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    red[i].first = a;
    red[i].second = b;
  }
  sort(red.begin(), red.end(),
       [](const pair<int, int>& p1, const pair<int, int>& p2) {
         return (p1.first == p2.first) ? (p1.second > p2.second)
                                       : (p1.first > p2.first);
       });
  for (int i = 0; i < n; i++) {
    cin >> c >> d;
    blue[i].first = c;
    blue[i].second = d;
  }
  sort(blue.begin(), blue.end(),
       [](const pair<int, int>& p1, const pair<int, int>& p2) {
         return (p1.first == p2.first) ? (p1.second > p2.second)
                                       : (p1.first > p2.first);
       });
  vector<bool> redpaired(n);
  for (int j = 0; j < n; ++j) {
    redpaired[j] = false;
  }
  for (int i = 0; i < n; ++i) {
    int maxsecond = -1, maxj = -1;
    for (int j = 0; j < n; ++j) {
      if (redpaired[j]) continue;
      if ((red[j].first < blue[i].first) && (red[j].second < blue[i].second)) {
        if (maxsecond < red[j].second) {
          maxsecond = red[j].second;
          maxj = j;
        }
      }
    }
    if (maxsecond != -1) {
      redpaired[maxj] = true;
    }
  }
  int p = 0;
  for (int i = 0; i < n; i++) {
    if (redpaired[i]) p++;
  }
  cout << p << endl;
  return 0;
}
