#include <bits/stdc++.h>
using namespace std;
bool first_greater(pair<int, int> l, pair<int, int> r) {
  if (l.first == r.first)
    return l.second > r.second;
  else
    return l.first > r.first;
}
bool second_greater(pair<int, int> l, pair<int, int> r) {
  if (l.second == r.second)
    return l.first > r.first;
  else
    return l.second > r.second;
}
int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> B(N);
  vector<pair<int, int>> R(N);
  vector<bool> checked_x(N, false);
  vector<bool> checked_y(N, false);
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    B[i] = make_pair(x, y);
  }
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    R[i] = make_pair(x, y);
  }
  int tmp_x = 0;
  sort(B.begin(), B.end(), first_greater);
  sort(R.begin(), R.end(), first_greater);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (B[i].first < R[j].first && B[i].second < R[j].second &&
          !checked_x[j]) {
        tmp_x++;
        checked_x[j] = true;
        break;
      }
    }
  }
  int tmp_y = 0;
  sort(B.begin(), B.end(), second_greater);
  sort(R.begin(), R.end(), second_greater);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (B[i].first < R[j].first && B[i].second < R[j].second &&
          !checked_y[j]) {
        tmp_y++;
        checked_y[j] = true;
        break;
      }
    }
  }
  cout << min(tmp_x, tmp_y);
}
