#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(26, 0);
  vector<int> b(26, 0);
  int n;
  cin >> n;
  string alpha = "abcdefghijklmnopqrstuvwxyz";
  for (int i = 0; i < n; i++) {
    string in;
    cin >> in;
    int id;
    for (int j = 0; j < 26; j++) {
      if (in[0] == alpha[j]) {
        id = j;
        break;
      }
    }
    if (a[id] < b[id])
      a[id]++;
    else
      b[id]++;
  }
  int total = 0;
  for (int i = 0; i < 26; i++) {
    if (a[i] > 1) total += (a[i]) * (a[i] - 1) / 2;
    if (b[i] > 1) total += (b[i]) * (b[i] - 1) / 2;
  }
  cout << total;
}
