import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.uni;
import std.range;
import std.algorithm;

void main()
{
    auto n = readln.strip.to!int;
    auto h = 0, t = 0;
    while (n--)
    {
        auto k = readln.strip.split(" ");
        if (k[0] == k[1])
        {
            t++;
            h++;
        }
        else if (k[0] > k[1])
        {
            t += 3;
        }
        else
        {
            h += 3;
        }
    }
    writeln(t, " ", h);
}
