import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n, t, h;
    t=0;
    h=0;
    n = sc.nextInt();
    String a,b;
    for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    }
    System.out.println(t+" "+h);
    }
    
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n, t, h;
    t=0;
    h=0;
    n = sc.nextInt();
    String a,b;
    for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    }
    System.out.println(t+" "+h);
    }
    
} Main public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n, t, h;
    t=0;
    h=0;
    n = sc.nextInt();
    String a,b;
    for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    }
    System.out.println(t+" "+h);
    } main {
    Scanner sc = new Scanner(System.in);
    int n, t, h;
    t=0;
    h=0;
    n = sc.nextInt();
    String a,b;
    for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    }
    System.out.println(t+" "+h);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n t t h; h t=0 t 0 h=0 h 0 n = sc.nextInt() n sc.nextInt() sc.nextInt sc String a a b; b for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    } {
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    } a=sc.next() a sc.next() sc.next sc b=sc.next() b sc.next() sc.next sc if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    } a.compareTo(b)>0 a.compareTo(b) a.compareTo a b 0 t+=3 t 3 if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    } a.compareTo(b)<0 a.compareTo(b) a.compareTo a b 0 h+=3 h 3 {
        t++;
        h++;
    } t++ t h++ h System.out.println(t+" "+h) System.out.println System.out System System.out t+" "+h t+" "+h t " " h String[] args args public class Main {
    public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n, t, h;
    t=0;
    h=0;
    n = sc.nextInt();
    String a,b;
    for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    }
    System.out.println(t+" "+h);
    }
    
} public class Main {
    public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n, t, h;
    t=0;
    h=0;
    n = sc.nextInt();
    String a,b;
    for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    }
    System.out.println(t+" "+h);
    }
    
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n, t, h;
    t=0;
    h=0;
    n = sc.nextInt();
    String a,b;
    for(int i=0;i<n;i++){
    a=sc.next();
    b=sc.next();
    if(a.compareTo(b)>0)t+=3;
    else if(a.compareTo(b)<0)h+=3;
    else {
        t++;
        h++;
    }
    }
    System.out.println(t+" "+h);
    }
    
}
