#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
char st[100000 + 5];
int size[100000 + 5], p[100000 + 5], c[100000 + 5][26], n, cnt, f[100000 + 5];
struct Heap {
  Heap *l, *r;
  int x, sz, val;
  Heap(int k) : x(k) {
    l = r = NULL;
    sz = 1;
    val = 0;
  }
  void Mark(int v) {
    x += v;
    val += v;
  }
} * rt[100000 + 5];
void pushdown(Heap* x) {
  if (x->l) x->l->Mark(x->val);
  if (x->r) x->r->Mark(x->val);
  x->val = 0;
}
Heap* Merge(Heap* x, Heap* y) {
  if (!x) return y;
  if (!y) return x;
  if (x->x < y->x) swap(x, y);
  pushdown(x);
  x->r = Merge(x->r, y);
  if ((x->l ? x->l->sz : 0) < (x->r ? x->r->sz : 0)) swap(x->l, x->r);
  x->sz = (x->l ? x->l->sz : 0) + (x->r ? x->r->sz : 0) + 1;
  return x;
}
long long ans;
void dfs(int x) {
  size[x] = 0;
  for (int i = 0; i < 26; ++i)
    if (c[x][i])
      dfs(c[x][i]), rt[x] = Merge(rt[x], rt[c[x][i]]), size[x] += size[c[x][i]];
  ans += size[x];
  if (p[x]) {
    if (rt[x]) rt[x]->Mark(1);
  } else {
    int s = rt[x]->x;
    ans -= s;
    pushdown(rt[x]);
    rt[x] = Merge(rt[x]->l, rt[x]->r);
    if (rt[x]) rt[x]->Mark(1);
  }
  rt[x] = Merge(rt[x], new Heap(1));
  size[x] += p[x];
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) {
    scanf("%s", st + 1);
    int x = 0;
    for (int j = 1; st[j]; ++j) {
      if (!c[x][st[j] - 'a']) c[x][st[j] - 'a'] = ++cnt;
      x = c[x][st[j] - 'a'];
    }
    p[x] = 1;
  }
  p[0] = 1;
  dfs(0);
  cout << ans;
  return 0;
}
