#include <iostream>

int main()
{
    int N, i=0, brS=0, brI=0, brO=0;
    int U[1001];
    int V[1001];
    char slovo[1001];
    scanf_s("%d", &N);
    for (i = 0; i < N; i++)
    {
        scanf_s("%d", &U[i]);
        scanf_s("%d", &V[i]);
        scanf_s("%c", &slovo[i]);
        if (slovo[i] == 'S')
        {
            brS++;
        }
        else if(slovo[i] == 'I')
        {
            brI++;
        }
        else
        {
            brO++;
        }
    }
    if (brS > brI && brS > brO)
    {
        printf("%d", brS);
    }
    else if (brI > brO)
    {
        printf("%d", brI);
    }
    else
    {
        printf("%d", brO);
    }

}