let content = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', buf => {
  content += buf;
});

process.stdin.on('end', () => {
  const points = [0, 0];
  const result = content
    .trim()
    .split('\n')
    .slice(1)
    .map(line => line.split(' '))
    .reduce((prev, cur) => calc(prev, cur), points);
  console.log(result.join(' '));
});

const calc = ([pointA, pointB], [wordA, wordB]) => {
  if (wordA > wordB) {
    return [pointA + 3, pointB];
  } else if (wordA < wordB) {
    return [pointA, pointB + 3];
  } else {
    return [pointA + 1, pointB + 1];
  }
};
