#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ans = 0, i, n;
  map<char, int> class_1;
  map<char, int> class_2;
  cin >> n;
  string names[n];
  for (i = 0; i < n; i++) {
    cin >> names[i];
  }
  for (i = 0; i < n; i++) {
    if (class_1[names[i][0]] > class_2[names[i][0]])
      class_2[names[i][0]]++;
    else
      class_1[names[i][0]]++;
  }
  for (map<char, int>::iterator it = class_1.begin(); it != class_1.end();
       it++) {
    if (it->second != 0) {
      ans += it->second * (it->second - 1) / 2;
    }
  }
  for (map<char, int>::iterator it = class_2.begin(); it != class_2.end();
       it++) {
    if (it->second != 0) {
      ans += it->second * (it->second - 1) / 2;
    }
  }
  cout << ans;
  return 0;
}
