#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
template <class T = long long>
T in() {
  T _in;
  cin >> _in;
  return _in;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  pair<int, int> red[100], blue[100];
  bool used[100] = {false};
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    red[i] = make_pair(a, b);
  }
  for (int i = 0; i < N; i++) {
    int c, d;
    cin >> c >> d;
    blue[i] = make_pair(c, d);
  }
  sort(red, red + N);
  sort(blue, blue + N);
  int ans = 0;
  for (int j = 0; j < N; j++) {
    int maxY = -1;
    int argMaxY = -1;
    for (int i = N - 1; i > -1; i--) {
      if (red[i].first < blue[j].first && !used[i]) {
        if (maxY < red[i].second && red[i].second < blue[j].second) {
          maxY = red[i].second;
          argMaxY = i;
        }
      }
    }
    if (maxY > -1) {
      used[argMaxY] = true;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
