void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  import std.typecons;
  alias Point=Tuple!(int, "x", int, "y");
  auto u=new Point[](n), v=new Point[](n);
  foreach(i; 0..n) rd(u[i].x, u[i].y);
  foreach(i; 0..n) rd(v[i].x, v[i].y);

  auto mf=new maxFlow(n*n+2), s=n*n, t=s+1;
  foreach(i; 0..n) mf.addEdge(s, i, 1), mf.addEdge(n+i, t, 1);
  foreach(i; 0..n)foreach(j; 0..n){
    if(u[i].x<v[j].x && u[i].y<v[j].y){
      // writeln(i, " ", j);
      mf.addEdge(i, n+j, 1);
    }
  }

  writeln(mf.ford(s, t));
}

class maxFlow{
  import std.typecons, std.conv, std.algorithm; // , std.stdio;
  alias T=int;
  alias Edge=Tuple!(int, "to", int, "rev", T, "cap");
  Edge[][] g;
  bool[] vis;
  auto inf=(1_000_000_000).to!(T);
 
  this(int sz){
    g.length=sz;
    vis.length=sz;
  }
 
  void addEdge(int from, int to, T cap){
    g[from]~=Edge(to, (g[to].length).to!(int), cap);
    g[to]~=Edge(from, (g[from].length-1).to!(int), (0).to!(T));
  }
 
  T flow(int i, T curf, int sink){
    if(i==sink) return curf;
    vis[i]=true;
    foreach(ref e; g[i]){
      if(vis[e.to] || e.cap==0) continue;
      auto tmpf=flow(e.to, min(curf, e.cap), sink);
      if(tmpf>0){
        e.cap-=tmpf;
        g[e.to][e.rev].cap+=tmpf;
        return tmpf;
      }
    }
    return 0;
  }
 
  T ford(int source, int sink){
    auto maxf=(0).to!(T);
    while(true){
      fill(vis, false);
      auto f=flow(source, inf, sink);
      if(f>0) maxf+=f;
      else return maxf;
    }
  }
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
