function main(input) {
    var n = input[0]-0;
    var alist = [];
    var blist = [];
    for(var i=1;i<=n;i++){
        alist.push(input[i].split(" ").map(v=>v-0));
        blist.push(input[i+n].split(" ").map(v=>v-0));
    }
    var nodes = [];
    for(var i=0;i<n;i++){
        nodes[i] = [];
        for(var j=0;j<n;j++){
            if(alist[i][0] < blist[j][0] && alist[i][1] < blist[j][1])
                nodes[i].push(j);
        }
    }
    console.log(calc(nodes, {}, 0,0));
    

}

function calc(nodes, usedmap, cnt, now){
    if(nodes.length == now ) return cnt;
    var ans = 0;
    for(var i=0;i<nodes[now].length;i++){
        if(!usedmap[nodes[now][i]]){
            var nextusedmap = JSON.parse(JSON.stringify(usedmap));
            nextusedmap[nodes[now][i]] = true;
            ans = Math.max(ans, calc(nodes, nextusedmap, cnt+1, now+1));
        }
    }
    ans = Math.max(ans, calc(nodes, JSON.parse(JSON.stringify(usedmap)), cnt, now+1));
    return ans;    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));
