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();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.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();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.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();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.setLength(0);
      }

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

      StringBuilder line  = new StringBuilder();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.setLength(0);
      }

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

      StringBuilder line  = new StringBuilder();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.setLength(0);
      }

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

      StringBuilder line  = new StringBuilder();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.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() StringBuilder wordA = new StringBuilder(); wordA new StringBuilder() StringBuilder wordB = new StringBuilder(); wordB new StringBuilder() 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 lenA = 0; lenA 0 int lenB = 0; lenB 0 int len = 0; len 0 for ( int i = 0; i < turn; i++ ) {

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.setLength(0);
      } {

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.setLength(0);
      } line.append(br.readLine()) line.append line br.readLine() br.readLine br wordA.append(line.substring(0, line.indexOf(" "))) wordA.append wordA line.substring(0, line.indexOf(" ")) line.substring line 0 line.indexOf(" ") line.indexOf line " " wordB.append(line.substring(line.indexOf(" ")+1, line.length())) wordB.append 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 if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA; (lenA = wordA.length()) < (lenB = wordB.length()) (lenA = wordA.length()) lenA wordA.length() wordA.length wordA (lenB = wordB.length()) lenB wordB.length() wordB.length wordB len = wordA.length() len wordA.length() wordA.length wordA if( lenA > lenB ) len = lenB;
        else len = lenA; lenA > lenB lenA lenB len = lenB len lenB len = lenA len lenA for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        } int j = 0; int j = 0; j 0 j < len j len j++ j++ j {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        } {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        } if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          } wordA.charAt(j) > wordB.charAt(j) wordA.charAt(j) wordA.charAt wordA j wordB.charAt(j) wordB.charAt wordB j {
            pointA += 3;
            break;
          } pointA += 3 pointA 3 break; if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          } wordB.charAt(j) > wordA.charAt(j) wordB.charAt(j) wordB.charAt wordB j wordA.charAt(j) wordA.charAt wordA j {
            pointB += 3;
            break;
          } pointB += 3 pointB 3 break; if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          } j == (len-1) j (len-1) len 1 {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            } lenA == lenB lenA lenB {
              pointA += 1;
              pointB += 1;
              break;
            } pointA += 1 pointA 1 pointB += 1 pointB 1 break; if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            } lenA > lenB lenA lenB {
              pointA += 3;
            } pointA += 3 pointA 3 {
              pointB += 3;
            } pointB += 3 pointB 3 {
            continue;
          } continue; line.setLength(0) line.setLength line 0 wordA.setLength(0) wordA.setLength wordA 0 wordB.setLength(0) wordB.setLength wordB 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();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.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();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.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();
      StringBuilder wordA = new StringBuilder();
      StringBuilder wordB = new StringBuilder();
      int turn = Integer.parseInt(br.readLine());
      int pointA = 0;
      int pointB = 0;
      int lenA = 0;
      int lenB = 0;
      int len = 0;


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

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

        if( (lenA = wordA.length()) < (lenB = wordB.length()) ) len = wordA.length();
        else if( lenA > lenB ) len = lenB;
        else len = lenA;

        for ( int j = 0; j < len; j++) {

          if ( wordA.charAt(j) > wordB.charAt(j)){
            pointA += 3;
            break;
          } else if ( wordB.charAt(j) > wordA.charAt(j) ) {
            pointB += 3;
            break;
          } else if ( j == (len-1) ) {
            if(lenA == lenB){
              pointA += 1;
              pointB += 1;
              break;
            } else if (lenA > lenB) {
              pointA += 3;
            } else {
              pointB += 3;
            }
          } else {
            continue;
          }
        }

        line.setLength(0);
        wordA.setLength(0);
        wordB.setLength(0);
      }

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