#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  char ch = getchar();
  bool f = false;
  while (!isdigit(ch)) {
    if (ch == '-') {
      f = true;
    }
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  x = f ? -x : x;
  return;
}
template <typename T>
inline void write(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 ^ 48);
  return;
}
const int N = 2e5 + 105;
int n, ans, sta[N], head[N], nex[N], to[N], dep[N], idx, top = 1, Root = 1, tot;
int ch[N][26];
bool endpos[N];
char s[N];
void add(int u, int v) {
  nex[++idx] = head[u];
  to[idx] = v;
  head[u] = idx;
  return;
}
int root[N];
struct Heap {
  int val, ls, rs;
} T[N];
int Merge(int x, int y) {
  if (!x || !y) return x | y;
  if (T[x].val < T[y].val) swap(x, y);
  T[x].rs = Merge(T[x].rs, y);
  if (rand() & 1) swap(T[x].ls, T[x].rs);
  return x;
}
void dfs(int x, int f) {
  dep[x] = dep[f] + 1;
  if (endpos[x]) T[root[x]].val = dep[x];
  for (int i = head[x]; i; i = nex[i]) {
    int y = to[i];
    dfs(y, x);
    root[x] = Merge(root[x], root[y]);
  }
  if (x && !endpos[x]) {
    ans -= T[root[x]].val - dep[x];
    T[++tot].val = dep[x];
    root[x] = Merge(Merge(T[root[x]].ls, T[root[x]].rs), root[tot]);
    endpos[x] = true;
  }
  return;
}
void Insert(char *str) {
  int len = strlen(str), p = Root;
  for (int i = 0; i < len; i++) {
    int c = str[i] - 'a';
    if (!ch[p][c]) ch[p][c] = ++top, add(p, top);
    p = ch[p][c];
  }
  endpos[p] = true;
  return;
}
int main() {
  srand(time(0));
  read(n);
  tot = N - 1e5;
  for (int i = 1; i <= N; i++) root[i] = i;
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    Insert(s);
    ans += strlen(s);
  }
  endpos[1] = true;
  dfs(1, 0);
  write(ans);
  return 0;
}
