#include <bits/stdc++.h>
using namespace std;
int count(int n) {
  int sum = 0, a, b;
  if (n == 1)
    return 0;
  else if (n == 2)
    return 0;
  if (n % 2 == 0)
    return ((n / 2) * ((n / 2) - 1));
  else {
    a = n / 2;
    b = a + 1;
    sum = (a * (a - 1)) / 2 + (b * (b - 1)) / 2;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  int i;
  int a[26] = {0};
  char c[50];
  int m, sum = 0;
  for (i = 0; i < n; i++) {
    cin >> c;
    m = (int)c[0];
    a[m - 97]++;
  }
  for (i = 0; i < 26; i++) {
    if (a[i] != 0) sum += count(a[i]);
  }
  cout << sum << " ";
}
