process.stdin.resume();
process.stdin.setEncoding("utf8");

const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});

const lines = [];

reader.on("line", (line) => {
  lines.push(line);
});

reader.on("close", () => {
  let t = 0,
    h = 0;
  const n = Number(lines[0]);
  for (let i = 1; i <= n; i++) {
    const [a, b] = lines[i].split(" ");
    if (a === b) {
      t++;
      h++;
    } else if (a < b) {
      h += 3;
    } else {
      t += 3;
    }
  }
  console.log(`${t} ${h}`);
});

