#include <iostream>

using namespace std;

int main()
{
    // some vars
    int N, count_pars = 0;

    // n input
    cin >> N;

    // some other vars
    int A = N - 1;
    int num_array[N - 1][2];
    string abc_array[N - 1];

    // inputs for numbers
    for (int i = 0; i < A; i++)
    {
        cin >> num_array[i][0] >> num_array[i][1] >> abc_array[i];
    }

    // count the pars
    for (int x = 0; x < A; x++)
    {
        if (abc_array[x] == "S")
        {
            count_pars++;
        }
    }

    // print the result
    cout << count_pars << endl;

    return 0;
}