#include <bits/stdc++.h>
using namespace std;
int n;
char s[100005];
priority_queue<int> pq;
struct Trie {
  int L, nr;
  Trie *fiu[26];
  Trie() {
    L = 0;
    nr = 0;
    memset(fiu, NULL, sizeof(fiu));
  }
};
Trie *T = new Trie;
inline void addTrie(Trie *nod, char *s) {
  if (*s == NULL) {
    nod->nr++;
    return;
  }
  if (nod->fiu[*s - 'a'] == NULL) {
    nod->fiu[*s - 'a'] = new Trie;
    nod->fiu[*s - 'a']->L = nod->L + 1;
  }
  addTrie(nod->fiu[*s - 'a'], s + 1);
}
inline void solve(Trie *nod, priority_queue<int> &pq) {
  priority_queue<int> auxpq;
  if (nod->nr > 0) {
    int nr = nod->nr, L = nod->L;
    while (nr > 0) pq.push(L), --nr;
  }
  for (int i = 0; i < 26; ++i) {
    if (nod->fiu[i] == NULL) continue;
    solve(nod->fiu[i], auxpq);
    while (!auxpq.empty()) {
      pq.push(auxpq.top());
      auxpq.pop();
    }
  }
  if (nod->nr == 0) {
    if (pq.empty()) return;
    pq.pop();
    pq.push(nod->L);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s);
    addTrie(T, s);
  }
  long long Sol = 0;
  for (int i = 0; i < 26; ++i) {
    if (T->fiu[i] == NULL) continue;
    solve(T->fiu[i], pq);
    while (!pq.empty()) {
      Sol += pq.top();
      pq.pop();
    }
  }
  printf("%lld", Sol);
  return 0;
}
