import java.awt.Frame;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import javax.sql.rowset.FilteredRowSet;
import javax.swing.BorderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.stream.events.EndDocument;
import java.math.BigInteger;
import java.time.chrono.MinguoChronology;
import java.util.Scanner;

public class Main {
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    }
    
//  End solution
  } 
  

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
} import java.awt.Frame; Frame java.awt import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.OutputStream; OutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Arrays; Arrays java.util import java.util.StringTokenizer; StringTokenizer java.util import javax.sql.rowset.FilteredRowSet; FilteredRowSet javax.sql.rowset import javax.swing.BorderFactory; BorderFactory javax.swing import javax.xml.parsers.DocumentBuilder; DocumentBuilder javax.xml.parsers import javax.xml.stream.events.EndDocument; EndDocument javax.xml.stream.events import java.math.BigInteger; BigInteger java.math import java.time.chrono.MinguoChronology; MinguoChronology java.time.chrono import java.util.Scanner; Scanner java.util public class Main {
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    }
    
//  End solution
  } 
  

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
} Main static InputReader in; in static PrintWriter out; out public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
} main {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
} in = new InputReader(System.in) in new InputReader(System.in) out = new PrintWriter(System.out) out new PrintWriter(System.out) Solution solver = new Solution(); solver new Solution() solver.solve() solver.solve solver out.close() out.close out String[] args args static class Solution {
    void solve() throws IOException {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    }
    
//  End solution
  } Solution void solve() throws IOException {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    } solve {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    } int n = in.nextInt(); n in.nextInt() in.nextInt in int taropoint = 0; taropoint 0 int hanakopoint = 0; hanakopoint 0 String tarocard; tarocard String hanakocard; hanakocard for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      } {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      } tarocard = in.next() tarocard in.next() in.next in hanakocard = in.next() hanakocard in.next() in.next in if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        } !tarocard.equals(hanakocard) tarocard.equals(hanakocard) tarocard.equals tarocard hanakocard {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            } int j = 0, min = Math.min(tarocard.length(), hanakocard.length()); int j = 0 j 0 min = Math.min(tarocard.length(), hanakocard.length()); min Math.min(tarocard.length(), hanakocard.length()) Math.min Math tarocard.length() tarocard.length tarocard hanakocard.length() hanakocard.length hanakocard j < min j min j++ j++ j {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            } {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            } if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              } tarocard.charAt(j) > hanakocard.charAt(j) tarocard.charAt(j) tarocard.charAt tarocard j hanakocard.charAt(j) hanakocard.charAt hanakocard j {
                taropoint += 3;
                break;
              } taropoint += 3 taropoint 3 break; if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              } tarocard.charAt(j) < hanakocard.charAt(j) tarocard.charAt(j) tarocard.charAt tarocard j hanakocard.charAt(j) hanakocard.charAt hanakocard j {
                hanakopoint += 3;
                break;
              } hanakopoint += 3 hanakopoint 3 break; if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              } j == min - 1 j min - 1 min 1 {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              } if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } min == tarocard.length() min tarocard.length() tarocard.length tarocard {
                  hanakopoint +=3;
                  break;
                } hanakopoint +=3 hanakopoint 3 break; taropoint += 3 taropoint 3 {
          taropoint++;
          hanakopoint++;
        } taropoint++ taropoint hanakopoint++ hanakopoint out.println(taropoint + " " + hanakopoint) out.println out taropoint + " " + hanakopoint taropoint + " " + hanakopoint taropoint " " hanakopoint static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  } InputReader public BufferedReader br; br public StringTokenizer st; st public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    } InputReader {
      br = new BufferedReader(new InputStreamReader(stream));
    } br = new BufferedReader(new InputStreamReader(stream)) br new BufferedReader(new InputStreamReader(stream)) InputStream stream stream public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    } nextInt {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    } while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
        st = new StringTokenizer(br.readLine());
      } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return Integer.parseInt(st.nextToken()); Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    } nextLong {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    } while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
        st = new StringTokenizer(br.readLine());
      } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return Long.parseLong(st.nextToken()); Long.parseLong(st.nextToken()) Long.parseLong Long st.nextToken() st.nextToken st public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    } next {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    } while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
        st = new StringTokenizer(br.readLine());
      } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    } nextDouble {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    } while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      } st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
        st = new StringTokenizer(br.readLine());
      } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return Double.parseDouble(st.nextToken()); Double.parseDouble(st.nextToken()) Double.parseDouble Double st.nextToken() st.nextToken st public class Main {
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    }
    
//  End solution
  } 
  

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
} public class Main {
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    }
    
//  End solution
  } 
  

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
} Main
import java.awt.Frame;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import javax.sql.rowset.FilteredRowSet;
import javax.swing.BorderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.stream.events.EndDocument;
import java.math.BigInteger;
import java.time.chrono.MinguoChronology;
import java.util.Scanner;

public class Main {
  static InputReader in;
  static PrintWriter out;
  
  static class Solution {
    void solve() throws IOException {
      int n = in.nextInt();
      int taropoint = 0;
      int hanakopoint = 0;
      String tarocard;
      String hanakocard;
      
      for (int i = 0; i < n; i++) {
        tarocard = in.next();
        hanakocard = in.next();
        
        if (!tarocard.equals(hanakocard)) {   
            for (int j = 0, min = Math.min(tarocard.length(), hanakocard.length());  j < min; j++) {
              if (tarocard.charAt(j) > hanakocard.charAt(j)) {
                taropoint += 3;
                break;
              } else if (tarocard.charAt(j) < hanakocard.charAt(j)){
                hanakopoint += 3;
                break;
              }
            
              if (j == min - 1) {
                if (min == tarocard.length()) {
                  hanakopoint +=3;
                  break;
                } 
                taropoint += 3;
              }
            }
        } else {
          taropoint++;
          hanakopoint++;
        }
      }
      
      out.println(taropoint + " " + hanakopoint);
      
//      End solve()
    }
    
//  End solution
  } 
  

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;
    
    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }
   
    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }
    
    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken()); 
    }
    
    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }
    
    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }
    
  }
  
}