#include <bits/stdc++.h>
using namespace std;
long long int binomialCoeff(long long int n, long long int k) {
  long long int C[k + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = min(i, k); j > 0; j--) C[j] = C[j] + C[j - 1];
  }
  return C[k];
}
int main() {
  long long int n;
  cin >> n;
  long long int ans = 0;
  map<char, int> s1, s2;
  while (n--) {
    string s;
    cin >> s;
    if (s1.count(s[0]) == 0) {
      s1[s[0]] = 1;
      continue;
    } else if (s2.count(s[0]) == 0) {
      s2[s[0]] = 1;
      continue;
    }
    if (s1[s[0]] <= s2[s[0]]) {
      s1[s[0]]++;
    } else {
      s2[s[0]]++;
    }
  }
  for (auto x : s1) {
    if (x.second >= 2) {
      ans += (binomialCoeff(x.second, 2));
    }
  }
  for (auto x : s2) {
    if (x.second >= 2) {
      ans += (binomialCoeff(x.second, 2));
    }
  }
  cout << ans;
}
