#include<iostream>
#include<string>
using namespace std;
int main(void){
    string tarou, hanako;
    int n,pt=0,ph=0;
    
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>tarou>>hanako;
        if(tarou==hanako) pt++, ph++;
        else if(tarou>hanako) pt+=3;
        else ph+=3;
    }
    cout<<pt<<" "<<ph<<endl;
}
