#include <bits/stdc++.h>
using namespace std;
struct iii {
  int a, b, c;
} arr[100 + 10], arr1[100 + 10];
bool cmp(iii a, iii b) {
  if (a.a != b.a)
    return a.a > b.a;
  else
    return a.b < b.b;
}
bool cmp1(iii a, iii b) {
  if (a.a != b.a)
    return a.a > b.a;
  else
    return a.b < b.b;
}
int main() {
  int n, mx = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].a >> arr[i].b;
    arr[i].c = 0;
  }
  sort(arr, arr + n, cmp);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> arr1[i].a >> arr1[i].b;
    arr1[i].c = 0;
  }
  sort(arr1, arr1 + n, cmp1);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (arr[j].a < arr1[i].a && arr[j].b < arr1[i].b && arr[j].c == 0 &&
          arr1[i].c == 0) {
        mx++;
        arr[j].c = 1;
        arr1[i].c = 1;
        break;
      }
    }
  }
  cout << mx << endl;
  return 0;
}
