function main(input){
    let lines =input.split("\n");
    let count = parseInt(lines.shift());
    let score = new Array(2).fill(0);
    for(let i=0;i<count;i++){
        let words = lines[i].split(" ");
        let sorted = new Array(...(Object.create(words).sort()));
        if(words[0]===words[1]){
            score[0]++;
            score[1]++;

        }else if(words.join("") === sorted.join("")){
            score[1]+=3;
        }else{
            score[0]+=3;
        }
    }
    console.log(score.join(" "));
}

main(require("fs").readFileSync("/dev/stdin","utf-8"));
