#include <bits/stdc++.h>
using namespace std;
int testCase;
string s;
int iinf = 1e9 + 1;
long long inf = 1e16 + 1;
void solve() {
  long long n;
  cin >> n;
  vector<int> a(26, 0), b(26, 0);
  int val;
  for (int i = 0; i < n; i++) {
    cin >> s;
    val = s[0] - 'a';
    if (a[val] <= b[val])
      a[val]++;
    else
      b[val]++;
  }
  long long ans = 0;
  for (int i = 0; i < 26; i++) {
    if (a[i] > 1) ans += (a[i] * (a[i] - 1)) / 2;
    if (b[i] > 1) ans += (b[i] * (b[i] - 1)) / 2;
  }
  cout << ans;
}
int main() {
  testCase = 1;
  while (testCase--) {
    solve();
    cout << "\n";
  }
}
