#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
struct edge {
  int ver, next;
} e[N * 2];
int n, t, Head[N], trie[N][26], End[N], Len[N], size[N], son[N], tot;
char p[N];
inline void insert(char *s) {
  int len = strlen(s + 1), now = 0;
  for (int i = 1; i <= len; i++) {
    int c = s[i] - 'a';
    if (!trie[now][c]) trie[now][c] = ++tot, Len[tot] = Len[now] + 1;
    now = trie[now][c];
  }
  End[now] = true;
}
inline void input(void) {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%s", p + 1), insert(p);
}
inline void connect(int x, int y) { e[++t] = (edge){y, Head[x]}, Head[x] = t; }
inline void dfs(int x) {
  size[x] = 1;
  for (int i = 0; i < 26; i++)
    if (trie[x][i]) {
      int y = trie[x][i];
      connect(x, y), dfs(y);
      size[x] += size[y];
      if (size[y] > size[son[x]]) son[x] = y;
    }
}
inline multiset<int> dsu(int x) {
  multiset<int> S;
  if (son[x]) S = dsu(son[x]);
  for (int i = Head[x]; i; i = e[i].next) {
    int y = e[i].ver;
    if (y == son[x]) continue;
    multiset<int> T = dsu(y);
    S.insert(T.begin(), T.end());
  }
  if (End[x]) S.insert(Len[x]);
  multiset<int>::iterator it = S.end();
  if (!End[x] && S.size() && x) S.erase(--it), S.insert(Len[x]);
  return S;
}
int main(void) {
  input();
  dfs(0);
  multiset<int> S = dsu(0);
  int ans = 0;
  multiset<int>::iterator it;
  for (it = S.begin(); it != S.end(); it++) ans += *it;
  printf("%d\n", ans);
  return 0;
}
