/*#include <bits/stdc++.h>
using namespace std;
int main()
{
double a, b, d;
char c;
scanf("%lfx%c%lf", &a, &c, &b);
d=-b;
printf("%.2lf", d/a);
}*/
/*
#include <bits/stdc++.h>
using namespace std;
bool boo=false;
unsigned long long n, a, b, c;
struct cmp{
bool operator()(unsigned long long x, unsigned long long y)
{
return x>y;
}
};
priority_queue <unsigned long long, vector<unsigned long long>, cmp> pq;
void haha(unsigned long long t, int cnt)
{
if(t<0||cnt>=20)
return ;
if(t%n==0)
{
pq.push(t);
}
haha(t*10, cnt+1);
haha(t*10+1, cnt+1);
}
int main()
{
cin >> n;
haha(1, 0);
if(pq.empty())
{
printf("0");
return 0;
}
printf("%llu", pq.top());
}*/
/*
#include <bits/stdc++.h>
using namespace std;
int arr[1002][1002], dist[1002][1002], n, m, start=0, top=0, qu[1002][2];
int anc, nex, ney;
int ha[4][2]={
{1, 0}, {0, 1}, {-1, 0}, {0, -1}
};
void bfs(int x, int y)
{
anc=dist[x][y];
for(int i=0;i<=3;i++)
{
nex=x+ha[i][0], ney=y+ha[i][1];
if(nex<1||ney<1||nex>n||ney>m||abs(arr[x][y]-arr[nex][ney])>1||dist[nex][ney]==987654321)
continue;
top++;
qu[top][0]=nex, qu[top][1]=ney;
dist[nex][ney]=dist[x][y]+1;
}
}
int main()
{
for(int i=0;i<=1001;i++)
for(int j=0;j<=1001;j++)
dist[i][j]=987654321;
scanf("%d %d", &n, &m);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
scanf("%d", &arr[i][j]);
}
top++;
qu[top][0]=1, qu[top][1]=1;
dist[1][1]=1;
while(top!=start)
{
start++;
bfs(qu[start][0], qu[start][1]);
}
if(dist[n][m]==987654321)
{
printf("0");
return 0;
}
printf("%d", dist[n][m]);
}
*/
/*
#include <bits/stdc++.h>
using namespace std;
#define INF 4500000000
struct line{
long long int m, n;
};
double cross(struct line x, struct line y)
{
return (y.n-x.n)/(x.m-y.m);
}
int main()
{
struct line temp, stk[100001];
long long int right=0, siz=0, r[100001], l[100001], a, b, t, top=0, pos, f, mid, start, End, left;
int n;
long long int dp[10001]={};
scanf("%lld", &t);
while(t--)
{
left=INF;
top=0, siz=0, right=0;
scanf("%d", &n);
for(int i=1;i<=n;i++)
{
scanf("%lld %lld", &a, &b);
if(left==INF)
left=min(left, a-b);
if(a+b<=right)
continue;
while(a-b<=l[siz]&&siz>0)
{
siz--;
}
siz++;
left=a-b;
r[siz]=a+b, l[siz]=a-b, right=a+b;
}
dp[1]=(r[1]-l[1])*(r[1]-l[1]);
top++;
stk[top].m=-l[1]*2, stk[top].n=l[1]*l[1];
for(int i=2;i<=siz;i++)
{
temp.m=(-1)*(l[i])*2, temp.n=dp[i-1]+l[i]*l[i];
while(top>1)
{
if(cross(stk[top], stk[top-1])<cross(temp, stk[top]))
break;
top--;
}
top++;
stk[top]=temp;
f=r[i];
pos=top;
if(f<cross(stk[top], stk[top-1]))
{
start=1, End=top;
while(start+1<End)
{
mid=(start+End)/2;
if(cross(stk[mid], stk[mid-1])>f)
{
End=mid-1;
}
else
{
start=mid;
}
}
pos=start;
}
dp[i]=(stk[pos].m*f)+stk[pos].n+(r[i]*r[i]);
dp[i]=min(dp[i], (r[i]-l[1])*(r[i]-l[1]));
}
cout << dp[siz]/4;
if(dp[siz]%4==1)printf(".25\n");
if(dp[siz]%4==2)printf(".50\n");
if(dp[siz]%4==3)printf(".75\n");
if(dp[siz]%4==0)printf(".00\n");
//for(int i=1;i<=siz;i++)
//printf("%d\n", dp[i]);
}
}*/
/*
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k, arr[20001]={}, ans=0;
scanf("%d %d\n", &n, &k);
string s;
cin >> s;
for(int i=0;i<n;i++)
{
if(s[i]=='H')
arr[i]=1;
}
for(int i=0;i<n;i++)
{
//printf("%d ", arr[i]);
if(s[i]!='H')
continue;
for(int j=max(0, i-k);j<=min(n-1, i+k);j++)
{
if(arr[j]==0)
{
arr[j]=1;
ans++;
break;
}
}
}
printf("%d", ans);
}*/
/*
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c, d, n, k;
cin >> n >> k;
if(k*(k+1)/2>n)
{
printf("-1");
return 0;
}
n-=k*(k+1)/2;
n%=k;
printf("%d", k+n-1);
}*/
/*
#include <bits/stdc++.h>
using namespace std;
int ans, arr[11][11], visited[11], n;
void backt(int x, int y)
{
if(x==n)
{
ans=max(ans, y);
return ;
}
for(int i=1;i<=n;i++)
{
if(!visited[i])
{
visited[i]=1;
backt(x+1, y+arr[x+1][i]);
visited[i]=0;
}
}
}
int main()
{
scanf("%d", &n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
scanf("%d", &arr[i][j]);
}
backt(0, 0);
printf("%d", ans);
}
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, ans=0;
cin >> n;
string s;
for(int i=1;i<=n;i++)
{
cin >> s;
for(int j=0;j<s.size();j++)
{
if(s[j]==',')
{
if(s[j+1]=='M')
ans++;
break;
}
}
}
printf("%d\n%d", ans, n-ans);
}



