import java.util.*;

class Main{
    public static void main(String[] args){
    	Scanner sc= new Scanner(System.in);
    	int tp=0,hp=0;
    	for(int m=sc.nextInt();m>0;m--){
        int ec=0;
    		char[]t=sc.next().toCharArray();
    		char[]h=sc.next().toCharArray();	
        for(int i=0;i<Math.min(t.length,h.length);i++){
        	if(t[i]>h[i]){
        		tp+=3;break;
        	}else if(t[i]<h[i]){
        		hp+=3;break;
        	}else if(t[i]==h[i]) ec++;
        }
        if(ec==Math.min(t.length,h.length)){
        	if(t.length>h.length){tp+=3;}
        	else if(t.length<h.length){hp+=3;}
        	else{tp++;hp++;} 	
        }
    }
    System.out.println(tp+" "+hp);
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz