import java.util.*

var n = -1
var g = BooleanArray( 0 )
var e = Array( 0, { BooleanArray( 0 ) } )
var u = IntArray( 0 )

fun main( args: Array<String> ) {
    val sc = Scanner( System.`in` )
    n = sc.nextInt()
    val x1 = IntArray( n )
    val y1 = IntArray( n )
    val x2 = IntArray( n )
    val y2 = IntArray( n )
    for ( i in 0 until n ) {
        x1[i] = sc.nextInt()
        y1[i] = sc.nextInt()
    }
    for ( i in 0 until n ) {
        x2[i] = sc.nextInt()
        y2[i] = sc.nextInt()
    }

    e = Array( n, { i -> BooleanArray( n, { j -> x1[i] < x2[j] && y1[i] < y2[j] } ) } )
    u = IntArray( n, { -1 } )
    var r = 0
    for ( i in 0 until n ) {
        g = BooleanArray( n, { false } )
        if ( dfs( i ) ) {
            r ++
        }
    }
    println( r )
    System.out.flush()
}

fun dfs( v: Int ): Boolean {
    if ( v < 0 ) return true
    if ( g[v] ) return false
    g[v] = true
    for ( i in 0 until n ) {
        if ( e[v][i] && dfs( u[i] ) ) {
            u[i] = v
            return true
        }
    }
    return false
}
