#include <bits/stdc++.h>
using namespace std;
struct Node {
  Node *ch[26];
  int sz, ed;
  multiset<int> *s;
} nds[200100], *rt;
int n, mem;
char tmp[101010];
void ins(const char *c, Node *&o) {
  if (!o) o = nds + mem++;
  o->sz++;
  if (*c)
    ins(c + 1, o->ch[*c - 'a']);
  else
    o->ed++;
}
int ans;
void work(int len, Node *o) {
  int i;
  if (!o->s) o->s = new multiset<int>();
  for (i = 0; i < 26; i++)
    if (o->ch[i]) {
      work(len + 1, o->ch[i]);
      if (o->ch[i]->s->size() > o->s->size()) swap(o->ch[i]->s, o->s);
      for (auto x : *(o->ch[i]->s)) {
        o->s->insert(x);
      }
      delete o->ch[i]->s;
    }
  if (o->ed) o->s->insert(len);
  if (o != rt && !o->ed) {
    int t = *(o->s->rbegin());
    ans -= t;
    ans += len;
    o->s->erase(o->s->find(t));
    o->s->insert(len);
  }
}
int main() {
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%s", tmp);
    ans += strlen(tmp);
    ins(tmp, rt);
  }
  work(0, rt);
  printf("%d", ans);
  return 0;
}
