#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int count = 0;
  int N;
  cin >> N;
  vector<pair<int, int> > red(N);
  vector<pair<int, int> > usedred(N);
  for (int i = 0; i < N; i++) {
    cin >> red[i].first >> red[i].second;
    usedred[i].first = -1;
    usedred[i].second = -1;
  }
  vector<pair<int, int> > blue(N);
  for (int i = 0; i < N; i++) {
    cin >> blue[i].first >> blue[i].second;
  }
  sort(red.begin(), red.end());
  sort(blue.begin(), blue.end());
  int maxredsecond = -1;
  for (int i = 0; i < N; i++) {
    maxredsecond = -1;
    for (int j = 0; j <= i; j++) {
      if (blue[i].first > red[j].first && usedred[j].second == -1) {
        if (maxredsecond < red[j].second) {
          maxredsecond = red[j].second;
        }
      }
    }
    for (int j = 0; j <= i; j++) {
      if (usedred[j].second == -1) {
        if (maxredsecond == red[j].second) {
          usedred[j].second = 0;
          count++;
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}
