#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,p=0;
    cin>>n;
    while(n--){
    string s;
	cin>>s; 
	if(s[0]>'G'&&s[0]<'R'||s[0]>'T'){
		p++;
	}
    }
    cout<<p;
	return 0;
}   
    
/**************************************************************
	Problem: 1181
	User: suzihang
	Language: C++
	Result: Accepted
	Time:7 ms
	Memory:2076 kb
****************************************************************/