#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double eps = (1e-7);
int dcmp(long double x, long double y) {
  if (abs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int freq[2][26];
  memset(freq, 0, sizeof(freq));
  int n;
  cin >> n;
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    int k = s[0] - 'a';
    if (freq[0][k] < freq[1][k]) {
      ans += freq[0][k];
      freq[0][k]++;
    } else {
      ans += freq[1][k];
      freq[1][k]++;
    }
  }
  cout << ans;
  return 0;
}
