#include <iostream>
using namespace std;

int n;
string s;
int k[30];
int w[] = {0, 2, 7, 12, 17};

int main () {

	cin >> n;
	for (int i = 0; i < n; i ++) {
		cin >> s;
		k[ s[0]-'A' ] ++;
		//cout << s[0]-'A' << "\n";
	}
	
	long long int sol = 0;
	for (int i = 0; i < 5; i ++) {
		for (int j = i+1; j < 5; j ++) {
			for (int l = j+1; l < 5; l ++) {
				sol += 1LL * k[ w[i] ] * k[ w[j] ] * k[ w[l] ];
			}
		}
	}
	cout << sol;

	return 0;
}