import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  }
} Main public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  } main {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  } try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    } {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) StringBuilder line  = new StringBuilder(); line new StringBuilder() String wordA; wordA String wordB; wordB int turn = Integer.parseInt(br.readLine()); turn Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int pointA = 0; pointA 0 int pointB = 0; pointB 0 int result = 0; result 0 for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      } int i = 0; int i = 0; i 0 i < turn i turn i++ i++ i {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      } {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      } line.append(br.readLine()) line.append line br.readLine() br.readLine br wordA = line.substring(0, line.indexOf(" ")) wordA line.substring(0, line.indexOf(" ")) line.substring line 0 line.indexOf(" ") line.indexOf line " " wordB = line.substring(line.indexOf(" ")+1, line.length()) wordB line.substring(line.indexOf(" ")+1, line.length()) line.substring line line.indexOf(" ")+1 line.indexOf(" ") line.indexOf line " " 1 line.length() line.length line result = wordA.compareTo(wordB) result wordA.compareTo(wordB) wordA.compareTo wordA wordB pointA += result == 0 ? 1 : result < 0 ? 0 : 3 pointA result == 0 ? 1 : result < 0 ? 0 : 3 result == 0 result 0 1 result < 0 ? 0 : 3 result < 0 result 0 0 3 pointB += result == 0 ? 1 : result < 0 ? 3 : 0 pointB result == 0 ? 1 : result < 0 ? 3 : 0 result == 0 result 0 1 result < 0 ? 3 : 0 result < 0 result 0 3 0 line.setLength(0) line.setLength line 0 System.out.println(pointA + " " + pointB) System.out.println System.out System System.out pointA + " " + pointB pointA + " " + pointB pointA " " pointB String[] args args public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  }
} public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      StringBuilder line  = new StringBuilder();
      String wordA;
      String wordB;
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int result = 0;

      for ( int i = 0; i < turn; i++ ) {

        line.append(br.readLine());
        wordA = line.substring(0, line.indexOf(" "));
        wordB = line.substring(line.indexOf(" ")+1, line.length());

        result = wordA.compareTo(wordB);
        pointA += result == 0 ? 1 : result < 0 ? 0 : 3;
        pointB += result == 0 ? 1 : result < 0 ? 3 : 0;

        line.setLength(0);
      }

      System.out.println(pointA + " " + pointB);
    }
  }
}
