#include <bits/stdc++.h>
using namespace std;
int C[7];
int main()
{
int maxw;
cin >> maxw;
for (int i = 0; i < maxw; ++i) {
string d;
cin >> d;
if (d == "pon") {
++C[0];
} else if (d == "wt") {
++C[1];
} else if (d == "sr") {
++C[2];
} else if (d == "czw") {
++C[3];
} else if (d == "pt") {
++C[4];
} else if (d == "sob") {
++C[5];
} else {
++C[6];
}
}
int minw = 0;
for (int i = 0; i < 7; ++i) {
minw = max(minw, C[i]);
}
cout << minw << " " << maxw << endl;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgQ1s3XTsKCmludCBtYWluKCkKewogICAgaW50IG1heHc7CiAgICBjaW4gPj4gbWF4dzsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbWF4dzsgKytpKSB7CiAgICAgICAgc3RyaW5nIGQ7CiAgICAgICAgY2luID4+IGQ7CiAgICAgICAgaWYgKGQgPT0gInBvbiIpIHsKICAgICAgICAgICAgKytDWzBdOwogICAgICAgIH0gZWxzZSBpZiAoZCA9PSAid3QiKSB7CiAgICAgICAgICAgICsrQ1sxXTsKICAgICAgICB9IGVsc2UgaWYgKGQgPT0gInNyIikgewogICAgICAgICAgICArK0NbMl07CiAgICAgICAgfSBlbHNlIGlmIChkID09ICJjenciKSB7CiAgICAgICAgICAgICsrQ1szXTsKICAgICAgICB9IGVsc2UgaWYgKGQgPT0gInB0IikgewogICAgICAgICAgICArK0NbNF07CiAgICAgICAgfSBlbHNlIGlmIChkID09ICJzb2IiKSB7CiAgICAgICAgICAgICsrQ1s1XTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICArK0NbNl07CiAgICAgICAgfQogICAgfQogICAgaW50IG1pbncgPSAwOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCA3OyArK2kpIHsKICAgICAgICBtaW53ID0gbWF4KG1pbncsIENbaV0pOwogICAgfQogICAgY291dCA8PCBtaW53IDw8ICIgIiA8PCBtYXh3IDw8IGVuZGw7CiAgICByZXR1cm4gMDsKfQ==