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 ptnmap = [];
    alist.forEach((v, i)=>{
        ptnmap[i] = [];
        blist.forEach((w, wi)=>{
            if(v[0]<w[0] && v[1]<w[1]) ptnmap[i].push(wi);
        });
    });
    
    console.log(calc(ptnmap, 0, []));
}

function calc(ptnmap, idx, used){
    if(idx>=ptnmap.length){
        return used.length;
    }
    var ans = 0;
    ans=Math.max(ans, calc(ptnmap, idx+1, used));
    for(var i=0;i<ptnmap[idx].length;i++){
        var use = ptnmap[idx][i];
        if(used.indexOf(use) == -1){
            ans=Math.max(ans, calc(ptnmap, idx+1, used.concat(use)));
        }
    }
    return ans;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));