#include <stdio.h>
int main(void){
   int N,i,j;
   scanf("%d",&N);
   int a[N],b[N],c[N],d[N],max_x,max_y,max_n;
   
   for(i=0;i<N;i++){
       scanf("%d %d",&a[i],&b[i]);
   }
   for(i=0;i<N;i++){
       scanf("%d %d",&c[i],&d[i]);
   }
   
   //ｘの小さい順にソート
   for(i=0;i<N;i++){
       max_x = 0;
       max_y = 0;
       max_n = i;
       for(j=i;j<N;j++){
           if(max_x < a[j]){
               max_x = a[j];
               max_y = b[j];
               max_n = j;
           }
       }
       a[max_n] = a[i];
       b[max_n] = b[i];
       a[i] = max_x;
       b[i] = max_y;
   }
   
   
   for(i=0;i<N;i++){
       max_x = 0;
       max_y = 0;
       max_n = i;
       for(j=i;j<N;j++){
           if(max_x < c[j]){
               max_x = c[j];
               max_y = d[j];
               max_n = j;
           }
       }
       c[max_n] = c[i];
       d[max_n] = d[i];
       c[i] = max_x;
       d[i] = max_y;
   }
   
   //更にｙの小さい順にソート
   
   
   for(i=0;i<N;i++){
       max_x = 0;
       max_y = 0;
       max_n = i;
       for(j=i;j<N;j++){
           if(max_y < b[j]){
               max_x = a[j];
               max_y = b[j];
               max_n = j;
           }
       }
       a[max_n] = a[i];
       b[max_n] = b[i];
       a[i] = max_x;
       b[i] = max_y;
   }
   
   for(i=0;i<N;i++){
       max_x = 0;
       max_y = 0;
       max_n = i;
       for(j=i;j<N;j++){
           if(max_x < d[j]){
               max_x = c[j];
               max_y = d[j];
               max_n = j;
           }
       }
       c[max_n] = c[i];
       d[max_n] = d[i];
       c[i] = max_x;
       d[i] = max_y;
   }
   
   //探索
   
   int count=0;
   
   for(i=0;i<N;i++){
       for(j=0,j<N,j++){
           if(a[i]<c[i] && b[i]<d[i]){
               count ++;
               c[i] = 0;
               d[i] = 0;
               break;
           }
       }
   }
   
   printf("%d",count);
}
