#include <bits/stdc++.h>
using namespace std;
const int mmax = 1e6 + 10;
const int eps = 1e-9;
struct node {
  string name;
} s[105];
long long cmp(node a, node b) {
  if (a.name == b.name) return a.name < b.name;
  return a.name < b.name;
}
int main() {
  long long n;
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> s[i].name;
    }
    sort(s, s + n, cmp);
    long long ans = 0, sum = 0;
    for (int i = 0; i < n; i++) {
      if (s[i].name[0] == s[i + 1].name[0])
        ans++;
      else {
        long long num0 = (ans + 1) / 2;
        long long num1 = ans + 1 - num0;
        long long sum0 = 0, sum1 = 0;
        for (int i = 1; i < num0; i++) sum0 += i;
        for (int i = 1; i < num1; i++) sum1 += i;
        sum += (sum0 + sum1);
        ans = 0;
      }
    }
    cout << sum << endl;
  }
  return 0;
}
