#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const double eps = 1e-6;
const int base = 131;
const int MAXN = 1e6 + 7;
int son[MAXN][26], dep[MAXN], idx, n, ans;
bool f[MAXN];
char s[MAXN];
priority_queue<int> heap[MAXN];
void insert() {
  int p = 0;
  for (int i = 0; s[i]; i++) {
    int c = s[i] - 'a';
    if (!son[p][c]) {
      son[p][c] = ++idx;
      dep[idx] = dep[p] + 1;
    }
    p = son[p][c];
  }
  f[p] = 1;
}
void Merge(int u, int son) {
  while (heap[son].size()) {
    heap[u].push(heap[son].top());
    heap[son].pop();
  }
}
void dfs(int u) {
  for (int i = 0; i < 26; i++)
    if (son[u][i]) dfs(son[u][i]);
  for (int i = 0; i < 26; i++)
    if (son[u][i]) Merge(u, son[u][i]);
  if (!u) return;
  if (f[u]) {
    ans += dep[u];
    heap[u].push(dep[u]);
    return;
  }
  ans -= heap[u].top() - dep[u];
  heap[u].pop();
  heap[u].push(dep[u]);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    insert();
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}
