import java.io.*;

class Main {
	public static void main(String[] args) {
		BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
		try {
			int n = Integer.parseInt( kb.readLine() );
			String[] cards = new String[ 2 ];
			int hanakoScore = 0, taroScore = 0;
			int i,j,hlen,tlen;
			i=0;			
	        while( i<n ) {
				cards = kb.readLine().split( " " );
				if( cards[0].equals( cards[1] ) ) {
					hanakoScore += 1;
					taroScore += 1;
				} else {
					j=0;
					hlen = cards[0].length();
					tlen = cards[1].length();
					while( true ) {
						if( cards[0].charAt( j ) < cards[1].charAt( j ) ) {
							taroScore += 3;
							break;
						} else if( cards[0].charAt( j ) > cards[1].charAt( j ) ) {
							hanakoScore += 3;
							break;						
						}
						j++;
						if( j == hlen || j == tlen ) {
							if( hlen < tlen ) {
								taroScore += 3;
								break;
							} else if( hlen > tlen ) {
								hanakoScore += 3;
								break;
							}
						}			
					}
				}
				i++;
	        }
	        
        	System.out.println( hanakoScore+" "+taroScore );				
		} catch( IOException e ) {
			System.err.println( e );
		}
	}
}
/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