#include <vector>
#include <cassert>
#include <set>
#include <queue>
#include <functional>
#include <algorithm>

struct edge {
  int to;
  int label;
};


::std::vector<::std::pair<int,int>> gabow_edmonds(const ::std::vector<::std::vector<int>>& gra){
  int N = gra.size();
  ::std::vector<::std::vector<edge>> g(N + 1);
  ::std::vector<::std::pair<int,int>> edges;
  {
    int cnt = N + 1;
    for(int i = 0;i < N;i++){
      for(auto to : gra[i]){
        if(i < to){
          g[to + 1].push_back({i + 1,cnt});
          g[i + 1].push_back({to + 1,cnt++});
          edges.push_back({i + 1, to + 1});
        }
      }
    }
  }
  ::std::vector<int> mate(N + 1 , 0);
  ::std::vector<int> label(N + 1 , -1);
  ::std::vector<int> first(N + 1 , 0);

  ::std::function<int(int)> eval_first = [&](int x){
    if(label[first[x]] < 0) return first[x];
    first[x] = eval_first(first[x]);
    return first[x];
  };

  ::std::function<void(int,int)> rematch = [&](int v,int w){
    int t = mate[v];
    mate[v] = w;
    if(mate[t] != v) return;
    if(label[v] <= N){
      mate[t] = label[v];
      rematch(label[v] , t);
    }
    else{
      int x = edges[label[v] - N + 1].first;
      int y = edges[label[v] - N + 1].second;
      rematch(x , y);
      rematch(y , x);
    }
  };

  ::std::function<void(int,int,int)> assignLabel = [&](int x, int y,int num){
    int r = eval_first(x);
    int s = eval_first(y);
    int join = 0;
    if(r == s) return;
    label[r] = -num;
    label[s] = -num;
    while(true){
      if(s != 0) ::std::swap(r , s);
      r = eval_first(label[mate[r]]);
      if(label[r] == -num){
        join = r;
        break;
      }
      label[r] = -num;
    }
    int v = first[x];
    while(v != join){
      label[v] = num;
      first[v] = join;
      v = first[label[mate[v]]];
    }
    v = first[y];
    while(v != join){
      label[v] = num;
      first[v] = join;
      v = first[label[mate[v]]];
    }
    return;
  };

  ::std::function<bool(int)> augment_check = [&](int u){
    first[u] = 0;
    label[u] = 0;
    ::std::queue<int> que;
    que.push(u);
    while(!que.empty()){
      int x = que.front();
      que.pop();
      for(auto e : g[x]){
        int y = e.to;
        if(mate[y] == 0 && y != u){
          mate[y] = x;
          rematch(x , y);
          return true;
        }
        else if(label[y] >= 0){
          assignLabel(x , y , e.label);
        }
        else if(label[mate[y]] < 0){
          label[mate[y]] = x;
          first[mate[y]] = y;
          que.push(mate[y]);
        }
      }
    }
    return false;
  };

  for(int i = 1;i <= N;i++){
    if(mate[i] != 0) continue;
    if(augment_check(i)){
      ::std::fill(label.begin() , label.end() , -1);
    }
  }

  ::std::vector<::std::pair<int,int>> ans;
  for(int i = 1;i <= N;i++){
    if(i < mate[i]){
      ans.push_back({i , mate[i]});
    }
  }
  return ans;
}

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int N;
 
int a[101];
int b[101];
int c[101];
int d[101];

int main(){
  cin >> N;
  rep(i,0,N - 1) cin >> a[i] >> b[i] ;
  rep(i,0,N - 1) cin >> c[i] >> d[i];

  vector<vector<int>> g(N * 2);

  rep(i,0,N - 1){
    rep(j,0,N - 1){
      if(a[i] < c[j] && b[i] < d[j]){
        g[i].push_back(j + N);
        g[j + N].push_back(i);
      }
    }
  }

  cout << gabow_edmonds(g).size() << endl;
}


Measured memory_bytes: 384