#include <bits/stdc++.h>
const int MAXN = 1e6;
struct Node {
  int x, y;
} a[MAXN], b[MAXN];
int n, ans1, ans2;
using namespace std;
bool cmp(Node A, Node B) {
  if (A.x == B.x)
    return A.y < B.y;
  else
    return A.x < B.x;
}
bool cmp1(Node A, Node B) {
  if (A.y == B.y)
    return A.x < B.x;
  else
    return A.y < B.y;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y);
  for (int i = 1; i <= n; i++) scanf("%d%d", &b[i].x, &b[i].y);
  int now = 1;
  sort(a + 1, a + 1 + n, cmp);
  sort(b + 1, b + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    while (now != n + 1) {
      if (b[now].x >= a[i].x && b[now].y >= a[i].y) {
        now++;
        ans1++;
        break;
      } else {
        now++;
        if (now == n + 1) {
          break;
        }
      }
    }
  }
  now = 1;
  sort(a + 1, a + n + 1, cmp1);
  sort(b + 1, b + n + 1, cmp1);
  for (int i = 1; i <= n; i++) {
    while (now != n + 1) {
      if (b[now].x >= a[i].x && b[now].y >= a[i].y) {
        now++;
        ans2++;
        break;
      } else {
        now++;
        if (now == n + 1) {
          break;
        }
      }
    }
  }
  cout << max(ans1, ans2);
  return 0;
}
