#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
int n;
struct TNODE {
  int ch[27];
  bool Bexi;
};
char Istr[N + 3];
int Ilen;
struct TRIE {
  TNODE nod[N + 10];
  int Tcnt, Trt;
  void Init() { Trt = Tcnt = 1; }
  void Insert(int &Pu, int Vpos) {
    if (!Pu) Pu = ++Tcnt;
    if (Vpos == Ilen) {
      nod[Pu].Bexi = true;
      return;
    }
    Insert(nod[Pu].ch[Istr[Vpos] - 'a' + 1], Vpos + 1);
  }
} Ttre;
struct HNODE {
  HNODE *ch[2];
  int Vkey, Vdis;
};
struct LHEAP {
  HNODE Hpol[N * 3], *Hrt[N + 3], *Hnul, *Hcnt;
  void Init() {
    Hcnt = Hnul = Hpol;
    Hnul->ch[0] = Hnul->ch[1] = Hnul;
    Hnul->Vkey = -1;
    Hnul->Vdis = -1;
  }
  void PushUp(HNODE *Pu) {
    if (Pu->ch[0]->Vdis < Pu->ch[1]->Vdis) swap(Pu->ch[0], Pu->ch[1]);
    Pu->Vdis = Pu->ch[0]->Vdis + 1;
  }
  HNODE *Merge(HNODE *Pu, HNODE *Pv) {
    if (Pu == Hnul) return Pv;
    if (Pv == Hnul) return Pu;
    if (Pu->Vkey > Pv->Vkey) {
      Pu->ch[1] = Merge(Pu->ch[1], Pv);
      PushUp(Pu);
      return Pu;
    } else {
      Pv->ch[1] = Merge(Pu, Pv->ch[1]);
      PushUp(Pv);
      return Pv;
    }
  }
  void Delete(int id) { Hrt[id] = Merge(Hrt[id]->ch[0], Hrt[id]->ch[1]); }
  HNODE *NewNode(int Vv) {
    HNODE *p = ++Hcnt;
    p->ch[0] = p->ch[1] = Hnul;
    p->Vdis = 0;
    p->Vkey = Vv;
    return p;
  }
  void NewHeap(int id, int Vv) { Hrt[id] = NewNode(Vv); }
  void Insert(int Vv, int id) { Hrt[id] = Merge(Hrt[id], NewNode(Vv)); }
} Hhep;
void DFS(int u, int dep) {
  if (Ttre.nod[u].Bexi)
    Hhep.NewHeap(u, dep);
  else
    Hhep.NewHeap(u, 0);
  for (int i = 1; i <= 26; i++)
    if (Ttre.nod[u].ch[i]) {
      int v = Ttre.nod[u].ch[i];
      DFS(v, dep + 1);
      Hhep.Hrt[u] = Hhep.Merge(Hhep.Hrt[u], Hhep.Hrt[v]);
    }
  if (!Ttre.nod[u].Bexi && u != 1) {
    Hhep.Delete(u);
    Hhep.Insert(dep, u);
  }
}
int Getsum(HNODE *u) {
  if (u == Hhep.Hnul) return 0;
  return u->Vkey + Getsum(u->ch[0]) + Getsum(u->ch[1]);
}
int main() {
  scanf("%d", &n);
  Ttre.Init();
  Hhep.Init();
  for (int i = 1; i <= n; i++) {
    scanf("%s", Istr);
    Ilen = strlen(Istr);
    Ttre.Insert(Ttre.Trt, 0);
  }
  DFS(1, 0);
  printf("%d\n", Getsum(Hhep.Hrt[1]));
  return 0;
}
