import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    }
    }
 
    static void solve(int n){
    int taro = 0;
    int hana = 0;
    String t, h;
 
    while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    }
 
    System.out.println(taro+" "+hana);
    }
} import java.util.*; util.* java public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    }
    }
 
    static void solve(int n){
    int taro = 0;
    int hana = 0;
    String t, h;
 
    while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    }
 
    System.out.println(taro+" "+hana);
    }
} Main static Scanner kbd = new Scanner(System.in); kbd new Scanner(System.in) public static void main(String[] args){
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    }
    } main {
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    }
    } while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    } kbd.hasNext() kbd.hasNext kbd {
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    } int n = kbd.nextInt(); n kbd.nextInt() kbd.nextInt kbd if(n!=0) solve(n); n!=0 n 0 solve(n) solve n String[] args args static void solve(int n){
    int taro = 0;
    int hana = 0;
    String t, h;
 
    while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    }
 
    System.out.println(taro+" "+hana);
    } solve {
    int taro = 0;
    int hana = 0;
    String t, h;
 
    while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    }
 
    System.out.println(taro+" "+hana);
    } int taro = 0; taro 0 int hana = 0; hana 0 String t t h; h while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    } n>0 n 0 {
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    } t = kbd.next() t kbd.next() kbd.next kbd h = kbd.next() h kbd.next() kbd.next kbd int j = t.compareToIgnoreCase(h); j t.compareToIgnoreCase(h) t.compareToIgnoreCase t h if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        } j < 0 j 0 {
        hana += 3;
        } hana += 3 hana 3 if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        } j > 0 j 0 {
        taro += 3;
        } taro += 3 taro 3 {
        hana += 1;
        taro += 1;
        } hana += 1 hana 1 taro += 1 taro 1 n-- n System.out.println(taro+" "+hana) System.out.println System.out System System.out taro+" "+hana taro+" "+hana taro " " hana int n n public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    }
    }
 
    static void solve(int n){
    int taro = 0;
    int hana = 0;
    String t, h;
 
    while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    }
 
    System.out.println(taro+" "+hana);
    }
} public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    }
    }
 
    static void solve(int n){
    int taro = 0;
    int hana = 0;
    String t, h;
 
    while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    }
 
    System.out.println(taro+" "+hana);
    }
} Main
import java.util.*;
public class Main{
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args){
    while(kbd.hasNext()){
        int n = kbd.nextInt();
        if(n!=0) solve(n);
    }
    }
 
    static void solve(int n){
    int taro = 0;
    int hana = 0;
    String t, h;
 
    while(n>0){
        t = kbd.next();
        h = kbd.next();
        int j = t.compareToIgnoreCase(h);
        if(j < 0){
        hana += 3;
        }
        else if(j > 0){
        taro += 3;
        }
        else{
        hana += 1;
        taro += 1;
        }
        n--;
    }
 
    System.out.println(taro+" "+hana);
    }
}