#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pii;

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

bool used[100];

int main()
{
  int n;
  cin >> n;

  pii r[n];
  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;

    r[i] = mp(b, a);
  }

  pii b[n];
  for(int i = 0; i < n; i++){
    int c, d;
    cin >> c >> d;

    b[i] = mp(c, d);
  }
  
  sort(r, r+n, greater<pii>());
  sort(b, b+n);

  int ans = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(!used[j] and b[i].first > r[j].second and b[i].second > r[j].first){
        used[j] = true;
        ans++;
        break;
      }
    }
  }

  cout << ans << endl;

  return 0;
}
