#include <bits/stdc++.h>
using namespace std;
int N;
vector<pair<pair<int, int>, char> > P;
set<int> Ry;
void input_data(void) {
  cin >> N;
  P.resize(2 * N);
  for (int i = 0; i < N; ++i) {
    cin >> P[i].first.first >> P[i].first.second;
    P[i].second = 'R';
  }
  for (int i = N; i < 2 * N; ++i) {
    cin >> P[i].first.first >> P[i].first.second;
    P[i].second = 'B';
  }
}
int solve(void) {
  int cnt = 0;
  for (int i = 0; i < 2 * N; ++i) {
    if (P[i].second == 'R')
      Ry.insert(P[i].first.second);
    else {
      set<int>::reverse_iterator itr;
      for (itr = Ry.rbegin(); itr != Ry.rend(); ++itr) {
        if (*itr < P[i].first.second) {
          Ry.erase(*itr);
          ++cnt;
          break;
        }
      }
    }
  }
  return cnt;
}
int main(void) {
  input_data();
  sort(P.begin(), P.end());
  int ans = solve();
  cout << ans << '\n';
  return 0;
}
