#include <bits/stdc++.h>
#define INF 0x3f3f3f
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define F first
#define S second
#define PB push_back
#define GCD __gcd
#define COUNT1 __builtin_popcount
#define FORJ(i,j,k) for(int i=j; i<k; ++i)
#define FOR(i,k) FORJ(i,0,k)
#define FORR(i,k) for(int i=k; i>=0; --i)
#define FORG(y,x,g) FOR(y, sz(g)) FOR(x, sz2(g))
#define CIN(a) int a; cin>>a;
#define CINC(a) char a; cin>>a;
#define CINS(a) string a; cin>>a;
#define CIND(a) double a; cin>>a;
#define CINLL(a) ll a; cin>>a;
#define CINP(a) PII a; cin>>a.F>>a.S;
#define CINLINE(a) string a; getline(cin, a);
#define CIN2(a,b) int a,b; cin>>a>>b;
#define CIN3(a,b,c) int a,b,c; cin>>a>>b>>c;
#define CIN4(a,b,c,d) int a,b,c,d; cin>>a>>b>>c>>d;
#define CINV(n,a) VI a; FOR(i,n) { CIN(x); a.PB(x); }
#define CINV2(n,a,b) VI a,b; FOR(i,n) { CIN2(x,y); a.PB(x); b.PB(y);}
#define CINVP(n,a) VP a; FOR(i,n) { CINP(p); a.PB(p);}
#define ALL(x) x.begin(), x.end()
#define D(x) cout<<#x<<": "<<(x)<<endl
#define H cout<<"H"<<hcnt++<<endl;

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<ll> VLL;
typedef vector<bool> VB;
typedef vector<string> VS;
typedef vector<PII> VP;
typedef vector<VI> GI;
typedef vector<VB> GB;
typedef vector<vector<char> > GC;
typedef map<char,int> MC;
typedef map<int,int> MI;
typedef map<string,int> MS;

void OUT(auto x) { cout<<x<<endl; }
void OUTP(PII &p) { cout<<p.F<<" "<<p.S<<endl; }
void OUTB(int x) { cout<<bitset<32>(x)<<endl; }
void OUTN(auto &x) { cout<<x->d<<endl; }
void OUTV(auto &x) { for(auto &d:x) cout<<d<<" "; cout<<endl; }
void OUTVP(VP &x) { for(auto &d:x) cout<<d.F<<" "<<d.S<<endl; }
void OUTVN(auto &x) { for(auto &d:x) cout<<d->d<<" "; cout<<endl; }
void OUTG(auto &x) { for(auto &v:x) { for(auto u:v) cout<<u; cout<<endl; } }
void OUTGN(auto &x) { 
  for(auto &v:x) { for(auto u:v) cout<<u->d<<" "; cout<<endl; } }
void OUTM(auto &x) { for(auto &p:x) cout<<p.F<<":"<<p.S<<" "; cout<<endl; }
PII operator+(const PII &l, const PII &r) { return {l.F+r.F, l.S+r.S}; }
void amin(auto &x, auto y) { if(y < x) x = y; }
void amax(auto &x, auto y) { if(x < y) x = y; }
auto mod(auto x, auto m) { return ((x % m) + m) % m; }
bool IsSameSign(auto a, auto b) { return ((a>=0) ^ (b<0)); }
int sz(const auto &x) { return (int)x.size(); }
int sz2(const auto &x) { return (int)x[0].size(); }
auto Safe(const auto &x, int i) { return i<0 || i>=sz(x) ? 0 : x[i]; }
bool Find(const auto &x, auto y) { return x.find(y) != x.end(); }
void Tally(const auto &v, auto &m) { for(auto &x : v) m[x]++; }

auto Min(const auto &v) { return *min_element(ALL(v)); }
auto Max(const auto &v) { return *max_element(ALL(v)); }
auto Count(const auto &v, auto x) { return count(ALL(v), x); }
auto Sum(const auto &a) { return accumulate(ALL(a), 0); }
bool Bsearch(const auto &v, auto x) { return binary_search(ALL(v),x); }
void Fill(auto &v, auto x) { fill(ALL(v), x); }
void Iota(auto &v, int i, int j) { FOR(k,sz(v)) { v[k]=i; i+=j; } }
void Sort(auto &v) { sort(ALL(v)); }
void Merge(const auto &a, const auto &b, auto &c) { 
  merge(ALL(a), ALL(b), inserter(c, c.begin())); }
void MergeInplace(auto &a, int x) { 
  inplace_merge(a.begin(), a.begin()+x, a.end()); }
void Union(const auto &a, const auto &b, auto &c) { 
  set_union(ALL(a), ALL(b), inserter(c, c.begin())); }
void Intersect(const auto &a, const auto &b, auto &c) { 
  set_intersect(ALL(a), ALL(b), inserter(c, c.begin())); }
void Diff(const auto &a, const auto &b, auto &c) { 
  set_difference(ALL(a), ALL(b), inserter(c, c.begin())); }
void Symdiff(const auto &a, const auto &b, auto &c) { 
  set_symmetric_difference(ALL(a), ALL(b), inserter(c, c.begin())); }

int hcnt=1;
VP nb4 = {{0,1}, {1,0}, {0,-1}, {-1,0}};
VP nb8 = {{0,1}, {1,1}, {1,0}, {1,-1}, {0,-1}, {-1,-1}, {-1,0}, {-1,1}};

//#include "custom.h"

bool cmpP(PII a, PII b) { 
  if(a.S == b.S) return a.F > b.F; 
  else return a.S > b.S;
}

int main() {
  CIN(n);
  CINVP(n,r);
  CINVP(n,b);
  sort(ALL(r), cmpP);
  Sort(b);
  VB v(n);

  int count=0;
  for(auto &p : b) {
    FOR(i,n) {
      if(v[i]) continue;
      if(r[i].F < p.F && r[i].S < p.S) {
	v[i]=1;
	count++;
	break;
      }
    }
  }
  OUT(count);
}


Measured memory_bytes: 256