#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000007LL;
const double EPS = 1e-14;
const long long inf_ll = (long long)1e18;
const long long maxn = 100005LL;
const long long mod = 810872LL;
int n;
char s[maxn];
long long f[maxn];
multiset<int> merge(multiset<int> A, multiset<int> B) {
  if (A.size() < B.size()) swap(A, B);
  for (multiset<int>::iterator it = B.begin(); it != B.end(); it++)
    A.insert(*it);
  return A;
}
struct Trie {
  struct node {
    int ch[26], dep, mark;
    multiset<int> val;
    node() : dep(0), mark(0) {
      val.clear();
      memset(ch, 0, sizeof(ch));
    }
  } T[maxn];
  int size;
  inline int new_node() {
    T[++size] = node();
    return size;
  }
  inline void insert(char *s) {
    int len = strlen(s), u = 0;
    for (register int(i) = (0); (i) <= (len - 1); ++i) {
      int v = T[u].ch[s[i] - 'a'];
      if (!v) {
        v = new_node();
        T[v].dep = i + 1;
        T[u].ch[s[i] - 'a'] = v;
      }
      u = v;
    }
    T[u].mark = 1;
  }
  inline void dfs(int u) {
    multiset<int> res;
    for (register int(i) = (0); (i) <= (25); ++i)
      if (T[u].ch[i]) {
        int v = T[u].ch[i];
        dfs(v);
        res = merge(res, T[v].val);
        f[u] += f[v];
      }
    if (!T[u].mark && !res.empty()) {
      int tmp = -*res.begin();
      f[u] += T[u].dep - tmp;
      res.erase(res.begin());
      res.insert(-T[u].dep);
    } else if (T[u].mark) {
      res.insert(-T[u].dep);
      f[u] += T[u].dep;
    }
    T[u].val = res;
  }
} trie;
long long ans;
int main() {
  scanf("%d", &n);
  for (register int(i) = (1); (i) <= (n); ++i) {
    scanf("%s", s);
    trie.insert(s);
  }
  for (register int(i) = (0); (i) <= (25); ++i)
    if (trie.T[0].ch[i]) {
      trie.dfs(trie.T[0].ch[i]);
      ans += f[trie.T[0].ch[i]];
    }
  printf("%I64d\n", ans);
  return 0;
}
