#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int t = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) t = t * 10 + c - '0', c = getchar();
  return t * f;
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    write(-x);
    return;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
inline void write_p(long long x) {
  write(x);
  putchar(' ');
}
int n;
string s[200001];
int son[200001][26], tot, l[200001], dep[200001], rk[200001], v[200001],
    to[200001];
long long ans;
vector<int> vec[2000001];
inline void Insert(string s, int x) {
  int len = s.length();
  int now = 0;
  for (int i = 0; i <= len - 1; ++i) {
    if (!son[now][s[i] - 'a']) son[now][s[i] - 'a'] = ++tot;
    dep[son[now][s[i] - 'a']] = dep[now] + 1;
    now = son[now][s[i] - 'a'];
  }
  to[now] = x;
}
int vis[200001];
multiset<int> hav[200001];
inline void Dfs(int x) {
  if (to[x]) hav[x].insert(dep[x]), ans += dep[x];
  for (int c = 0; c <= 25; ++c) {
    if (!son[x][c]) continue;
    Dfs(son[x][c]);
    multiset<int>::iterator it = hav[son[x][c]].begin();
    while (1) {
      it++;
      if (*it == 1e9) break;
      hav[x].insert(*it);
    }
  }
  multiset<int>::iterator it = hav[x].end();
  it--;
  it--;
  if (*it != -1e9 && x && !to[x]) {
    ans -= *it;
    ans += dep[x];
    hav[x].insert(dep[x]);
    hav[x].erase(it);
  }
}
inline bool cmp(int x, int y) { return v[l[x]] > v[l[y]]; }
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    Insert(s[i], i);
  }
  for (int i = 1; i <= tot; ++i) hav[i].insert(-1e9), hav[i].insert(1e9);
  Dfs(0);
  writeln(ans);
}
