#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int size[maxn], ms[maxn], n;
int nxt[maxn][30];
multiset<int> s[maxn];
int tot = 0;
int val[maxn];
void init() { memset(nxt, -1, sizeof(nxt)); }
void insert(char *s) {
  int n = strlen(s);
  int u = 0;
  for (int i = 0; i < n; i++) {
    if (nxt[u][s[i] - 'a'] == -1) nxt[u][s[i] - 'a'] = ++tot;
    u = nxt[u][s[i] - 'a'];
  }
  val[u] = 1;
}
void dfs(int u) {
  size[u] = 1;
  for (int i = 0; i < 26; i++) {
    if (nxt[u][i] == -1) continue;
    dfs(nxt[u][i]);
    if (size[ms[u]] < size[nxt[u][i]]) ms[u] = nxt[u][i];
  }
}
void solve(int u, int d) {
  if (ms[u]) solve(ms[u], d + 1), swap(s[u], s[ms[u]]);
  for (int i = 0; i < 26; i++) {
    int v = nxt[u][i];
    if (v == -1 || v == ms[u]) continue;
    solve(v, d + 1);
    for (auto x : s[v]) s[u].insert(x);
    s[v].clear();
  }
  if (val[u])
    s[u].insert(d);
  else if (u && s[u].size()) {
    auto it = s[u].end();
    it--;
    s[u].erase(it);
    s[u].insert(d);
  }
}
char a[maxn];
int main() {
  scanf("%d", &n);
  init();
  for (int i = 1; i <= n; i++) scanf("%s", a), insert(a);
  dfs(0);
  solve(0, 0);
  long long ans = 0;
  for (auto x : s[0]) ans += x;
  printf("%lld\n", ans);
  return 0;
}
