#include <bits/stdc++.h>
using namespace std;
char ss[100005];
int nxt[100005][26];
bool vis[100005];
int rt, tot, n;
void insert(char *s) {
  int len = strlen(s);
  int nd = rt;
  for (int i = 0; i < len; i++) {
    if (!nxt[nd][s[i] - 'a']) nxt[nd][s[i] - 'a'] = ++tot;
    nd = nxt[nd][s[i] - 'a'];
  }
  vis[nd] = 1;
}
multiset<int> s[100005];
void dfs(int k, int dep) {
  int hs = k, d = 0;
  for (int i = 0; i < 26; i++)
    if (nxt[k][i]) {
      int y = nxt[k][i];
      dfs(y, dep + 1);
      if (s[y].size() > d) {
        hs = y;
        d = s[y].size();
      }
    }
  for (int i = 1; i <= 100; i++) s[k].insert(i);
  s[k].clear();
  s[k] = s[hs];
  if (hs == k) s[k].clear();
  for (int i = 0; i < 26; i++) {
    int y = nxt[k][i];
    if (!y || y == hs) continue;
    for (auto x : s[y]) s[k].insert(x);
  }
  if (vis[k]) s[k].insert(dep);
  if (!vis[k] && dep) {
    s[k].erase(prev(s[k].end()));
    s[k].insert(dep);
  }
  return;
}
int main() {
  for (scanf("%d", &n); n--;) {
    scanf("%s", ss);
    insert(ss);
  }
  dfs(0, 0);
  long long sum = 0;
  for (auto x : s[0]) sum += x;
  printf("%I64d\n", sum);
}
