#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  sort(s, s + n);
  int ans = 0, flag = 0, fans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i][0] == s[i + 1][0]) {
      ans++;
      if (flag == 0) {
        ans++;
      }
      flag = 1;
    } else {
      flag = 0;
      int temp1 = ceil((double)ans / 2), temp2 = ans / 2;
      fans += (temp1 * (temp1 - 1)) / 2 + (temp2 * (temp2 - 1)) / 2;
      ans = 0;
    }
  }
  int temp1 = ceil((double)ans / 2), temp2 = ans / 2;
  fans += (temp1 * (temp1 - 1)) / 2 + (temp2 * (temp2 - 1)) / 2;
  cout << fans;
}
