# include <bits/stdc++.h>

using namespace std;

const int inf = 1e9 + 7;
const int N = 205;

int n, a[N], b[N], c[N], d[N], ans;
int g[N][N], mt[N], used[N];

bool try_kuhn(int v){
      if(used[v]) return false;
      used[v] = 1;
      for(int i = 1; i <= n + n; i ++){
            if(g[v][i] && (mt[i] == -1 || try_kuhn(mt[i]))){
                  mt[i] = v;
                  return true;
            }
      }
      return false;
}

int main(){
      cin >> n;

      for(int i = 1; i <= n; i ++){
            cin >> a[i] >> b[i];
      }
      for(int i = 1; i <= n; i ++){
            cin >> c[i] >> d[i];
      }

      for(int i = 1; i <= n; i ++){
            for(int j = 1; j <= n; j ++){
                  if(a[i] <= c[j] && b[i] <= d[j]){
                        g[i][j + n] = 1;
                        g[j + n][i] = 1;
                  }
            }
            mt[i] = -1;
            mt[i + n] = -1;
      }

      for(int i = 1; i <= n; i ++){
            for(int j = 1; j <= n + n; j ++)
                  used[j] = 0;
            try_kuhn(i);
      }
      for(int i = 1; i <= n; i ++){
            if(mt[i + n] != -1) ans ++;
      }

      cout << ans << endl;
}
