#include <bits/stdc++.h>
using namespace std;
struct trie {
  struct tree {
    long long al[26];
    bool ex;
  } nxt[100005];
  long long cnt, dep[100005];
  void insert(char *s) {
    long long l = strlen(s), rt = 0;
    for (register long long i = 0; i < l; i++) {
      long long c = s[i] - 'a';
      if (!nxt[rt].al[c]) nxt[rt].al[c] = ++cnt, dep[cnt] = dep[rt] + 1;
      rt = nxt[rt].al[c];
    }
    nxt[rt].ex = 1;
  }
} tr;
priority_queue<long long> q[100005];
long long n, ans = 0;
char s[100005];
template <typename T>
inline void read(T &x) {
  T c = getchar(), f = 0;
  for (; c < 48 || 57 < c; c = getchar())
    if (c == '-') f = 1;
  for (x = 0; 48 <= c && c <= 57; c = getchar())
    x = (x << 3) + (x << 1) + (c ^ 48);
  if (f) x = -x;
}
template <typename T>
inline void print(T x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) print(x / 10);
  putchar(x % 10 + 48);
}
inline void merge(long long x, long long y) {
  while (!q[y].empty()) q[x].push(q[y].top()), q[y].pop();
}
void dfs(long long x) {
  for (register long long i = 0; i < 26; i++)
    if (tr.nxt[x].al[i]) dfs(tr.nxt[x].al[i]);
  for (register long long i = 0; i < 26; i++)
    if (tr.nxt[x].al[i]) merge(x, tr.nxt[x].al[i]);
  if (!x) return;
  if (tr.nxt[x].ex)
    ans += tr.dep[x], q[x].push(tr.dep[x]);
  else
    ans -= q[x].top() - tr.dep[x], q[x].pop(), q[x].push(tr.dep[x]);
}
signed main() {
  scanf("%lld", &n);
  for (register long long i = 1; i <= n; i++) scanf("%s", s), tr.insert(s);
  dfs(0), printf("%lld", ans);
  return 0;
}
