#include <bits/stdc++.h>
using namespace std;
int n;
int m;
char buf[500008];
int h[500008];
int w[500008];
int lc[500008], rc[500008];
int tot;
void up(int a) {
  if (h[lc[a]] < h[rc[a]]) swap(lc[a], rc[a]);
  if (lc[a] == 0 or rc[a] == 0)
    h[a] = 1;
  else
    h[a] = h[rc[a]] + 1;
}
int merge(int a, int b) {
  if (a == 0 or b == 0) return a + b;
  if (w[a] < w[b]) swap(a, b);
  rc[a] = merge(rc[a], b);
  up(a);
  return a;
}
void push(int &a, int b) {
  int ff = 0;
  ff = ++tot;
  w[ff] = b;
  h[ff] = 0;
  a = merge(a, ff);
}
void pop(int &a) { a = merge(lc[a], rc[a]); }
int calc(int a) {
  if (a == 0) return 0;
  return w[a] + calc(lc[a]) + calc(rc[a]);
}
struct TRIE {
  int ch[65536 * 8][26];
  int man[65536 * 8];
  int tot;
  int pa[65536 * 8];
  int dep[65536 * 8];
  int siz[65536 * 8];
  void insert(string s) {
    man[0] = 1;
    int now = 0;
    for (int i = 0; i < s.size(); i++) {
      int t = s[i] - 'a';
      if (!ch[now][t])
        ch[now][t] = ++tot, pa[tot] = now, dep[tot] = dep[now] + 1;
      now = ch[now][t];
      siz[now]++;
    }
    man[now] = 1;
  }
  void goup(int x) {
    if (man[pa[x]] == 1 or man[x] == 0) return;
    man[x] = 0;
    man[pa[x]] = 1;
    goup(pa[x]);
  }
  bool cmp(int x, int y) { return siz[x] > siz[y]; }
  int dfs(int x) {
    int rt = 0;
    for (int i = 0; i < 26; i++) {
      if (ch[x][i] == 0) continue;
      int rc = dfs(ch[x][i]);
      rt = merge(rt, rc);
    }
    if (man[x] == 0) pop(rt);
    push(rt, dep[x]);
    return rt;
  }
} trie;
string getins() {
  string s = "";
  scanf("%s", buf);
  int l = strlen(buf);
  for (int i = 0; i < l; i++) s += buf[i];
  return s;
}
int main() {
  cin >> n;
  while (n--) trie.insert(getins());
  cout << calc(trie.dfs(0)) << endl;
  return 0;
}
