#include <bits/stdc++.h>
#define p pair<int, int>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<p> ab, cd;
  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;
    ab.push_back(p(a, b));
  }
  for(int i = 0; i < n; i++){
    int c, d;
    cin >> c >> d;
    cd.push_back(p(c, d));
  }
  sort(cd.begin(), cd.end());
  int used[205] = {};
  int sum = 0;
  for(int i = 0; i < n; i++){
    vector<p> v;
    for(int j = 0; j < n; j++){
      if(used[j]) continue;
      if(ab[j].first < cd[i].first && ab[j].second < cd[i].second){
        v.push_back(p(ab[j].second, j));
      }
    }
    if(v.size() >= 1){
      sort(v.begin(), v.end());
      sum++;
      used[v[v.size()-1].second] = 1;
    }
  }
  cout << sum << endl;
  return 0;
}
