#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
int main() {
  int n;
  cin >> n;
  vector<string> first;
  vector<string> second;
  for (int i = 0; i < n; i++) {
    int k1 = 0, k2 = 0;
    string b;
    cin >> b;
    for (int j = 0; j < first.size(); j++) {
      if (b[0] == first[j][0]) k1++;
    }
    for (int j = 0; j < second.size(); j++) {
      if (b[0] == second[j][0]) k2++;
    }
    if (k1 <= k2)
      first.push_back(b);
    else
      second.push_back(b);
  }
  int res = 0;
  for (int i = 0; i < first.size(); i++) {
    for (int j = i + 1; j < first.size(); j++) {
      if (first[i][0] == first[j][0]) res++;
    }
  }
  for (int i = 0; i < second.size(); i++) {
    for (int j = i + 1; j < second.size(); j++) {
      if (second[i][0] == second[j][0]) res++;
    }
  }
  cout << res;
}
