#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
     
     
const int MAX_V = 210;
const int INF = 1e9;
     
struct edge {
  int to, cap, rev;
};
     
vector<edge> G[MAX_V];
bool used[MAX_V];
     
void add_edge(int from, int to, int cap) {
  G[from].push_back((edge){to, cap, G[to].size()});
  G[to].push_back((edge){from, 0, G[from].size() - 1});
}
     
int dfs(int v, int t, int f) {
  if (v == t) return f;
  used[v] = true;
  for (int i = 0; i < G[v].size(); i++) {
    edge &e = G[v][i];
    if (!used[e.to] && e.cap > 0) {
      int d = dfs(e.to, t, min(f, e.cap));
      if (d > 0) {
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}
     
int max_flow(int s, int t) {
  int flow = 0;
  for (;;) {
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if (f == 0) return flow;
    flow += f;
  }
}
     
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n), d(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> d[i];
  }
     
  int start = 0;
  int goal = 2*n+1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i] < c[j] and b[i] < d[j]) {
	add_edge(i+1, n+j+1, 1);
      }
    }
  }
     
  for (int i = 0; i < n; i++) {
    add_edge(0, i+1, 1);
    add_edge(n+i+1, 2*n+1, 1);
  }
     
  cout << max_flow(start, goal) << endl;
     
  return 0;
}