#include <bits/stdc++.h>
using namespace std;
struct Vertex {
  long long go[26];
  bool have;
};
long long n, ans;
vector<Vertex> bor;
vector<deque<long long> > vd;
void create() {
  Vertex v;
  for (long long i = 0; i < 26; i++) v.go[i] = -1;
  v.have = false;
  bor.push_back(v);
}
long long add(long long sost, long long ind) {
  if (bor[sost].go[ind] == -1) {
    create();
    bor[sost].go[ind] = bor.size() - 1;
  }
  return bor[sost].go[ind];
}
bool cmp(long long a, long long b) { return (vd[a].size() > vd[b].size()); }
long long dfs(long long vertex) {
  vector<long long> v;
  for (long long i = 0; i < 26; i++) {
    if (bor[vertex].go[i] == -1) continue;
    long long dr = dfs(bor[vertex].go[i]);
    v.push_back(dr);
  }
  sort(v.begin(), v.end(), cmp);
  if (!v.size()) {
    deque<long long> dd;
    dd.push_back(1);
    vd.push_back(dd);
    return vd.size() - 1;
  }
  for (long long i = 1; i < v.size(); i++) {
    for (long long j = 0; j < vd[v[i]].size(); j++) {
      vd[v[0]][j] += vd[v[i]][j];
    }
  }
  vd[v[0]].push_front(bor[vertex].have);
  if (vertex == 0) return v[0];
  if (!bor[vertex].have) {
    vd[v[0]][0]++;
    vd[v[0]].back()--;
    while (!vd[v[0]].back()) vd[v[0]].pop_back();
  }
  return v[0];
}
int32_t main() {
  cin >> n;
  create();
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    long long sost = 0;
    for (long long j = 0; j < s.size(); j++) {
      sost = add(sost, s[j] - 'a');
    }
    bor[sost].have = true;
  }
  ans = 0;
  long long ibor = dfs(0);
  for (long long i = 0; i < vd[ibor].size(); i++) {
    ans += i * vd[ibor][i];
  }
  cout << ans;
}
