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