#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
char s[N];
int ans, tot = 1, n, f[N][26], g[N], sd[N];
struct cmp {
  int operator()(int a, int b) { return sd[a] < sd[b]; }
};
priority_queue<int, vector<int>, cmp> q[N];
void build(char s[]) {
  int now = 1;
  for (int i = 0; s[i]; i++) {
    if (f[now][s[i] - 'a'] == 0) {
      f[now][s[i] - 'a'] = ++tot;
      sd[tot] = sd[now] + 1;
    }
    now = f[now][s[i] - 'a'];
  }
  g[now] = 1;
}
void dfs(int now) {
  while (!q[now].empty()) q[now].pop();
  for (int i = 0; i < 26; i++)
    if (f[now][i]) {
      dfs(f[now][i]);
      while (!q[f[now][i]].empty()) {
        q[now].push(q[f[now][i]].top());
        q[f[now][i]].pop();
      }
    }
  if (now != 1 && !g[now] && !q[now].empty()) {
    g[now] = 1;
    g[q[now].top()] = 0;
    q[now].pop();
  }
  if (g[now]) q[now].push(now);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    build(s);
  }
  dfs(1);
  while (!q[1].empty()) {
    ans += sd[q[1].top()];
    q[1].pop();
  }
  printf("%d", ans);
}
