#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<string> a;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    a.push_back(s);
  }
  sort(a.begin(), a.end());
  vector<string> x, y;
  int aa = 0;
  for (int i = 0; i < n; i++) {
    if (aa == 0) {
      x.push_back(a[i]);
      aa = 1;
    } else {
      y.push_back(a[i]);
      aa = 0;
    }
  }
  int c = 1;
  long long s = 0;
  for (int i = 1; i < x.size(); i++) {
    if (x[i][0] == x[i - 1][0]) {
      c++;
    } else {
      s += c * (c - 1) / 2;
      c = 1;
    }
  }
  s += c * (c - 1) / 2;
  c = 1;
  for (int i = 1; i < y.size(); i++) {
    if (y[i][0] == y[i - 1][0]) {
      c++;
    } else {
      s += c * (c - 1) / 2;
      c = 1;
    }
  }
  s += c * (c - 1) / 2;
  cout << s;
  return 0;
}
