ソースコード
#include <bits/stdc++.h>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++)
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
#define vci vector<ll>
#define vcs vector<string>
#define vcp vector<pair<ll, ll>>
#define vct vector<tuple<ll, ll, ll>>
using namespace std;
//vector<vector<ll>> vv(n, vector<ll>(n));
typedef int Weight;
struct Edge
{
int from, to; Weight cost;
bool operator < (const Edge& e) const { return cost < e.cost; }
bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
g[from].push_back(Edge{ from, to, cost });
}
int main()
{
ll n, a = 0, b = 0;
cin >> n;
REP(i, n)
{
string s;
cin >> s;
if (s.size() == 5) a++;
else b++;
}
cout << a*(a - 1)*b << endl;
}