#include <bits/stdc++.h>
using namespace std;
int numbit(int x) { return (1 << x) - 1; }
int getbit(int x, int i) { return (x >> i) & 1; }
int onbit(int x, int i) { return x | (1 << i); }
int offbit(int x, int i) { return x & (~(1 << i)); }
const int maxInt = 1000000000;
const int Nmax = 100010;
int N, m;
struct tnode {
  tnode *go[26];
  bool term;
  tnode() {
    for (int i = (0); i <= (25); i++) go[i] = NULL;
    term = false;
  }
};
using pnode = tnode *;
pnode root;
char s[Nmax];
void add() {
  pnode cur = root;
  char *t = s;
  while (*t != '\0') {
    if (cur->go[*t - 'a'] == NULL) cur->go[*t - 'a'] = new tnode();
    cur = cur->go[*t - 'a'];
    t++;
  }
  cur->term = true;
}
using tans = multiset<int>;
using pans = tans *;
pans merge(pans a, pans b) {
  if (a->size() > b->size()) swap(a, b);
  for (auto t : *a) b->insert(t);
  delete a;
  return b;
}
pans calc(pnode cur, int l) {
  pans ans = new tans;
  for (int i = (0); i <= (25); i++)
    if (cur->go[i] != NULL) {
      auto t = calc(cur->go[i], l + 1);
      ans = merge(ans, t);
    }
  if (cur->term)
    ans->insert(l);
  else if (l != 0) {
    ans->erase(prev(ans->end()));
    ans->insert(l);
  }
  return ans;
}
int main() {
  root = new tnode();
  scanf("%d", &N);
  m = 0;
  for (int i = (1); i <= (N); i++) {
    scanf("%s", &s);
    add();
  }
  auto ans = calc(root, 0);
  int res = 0;
  for (auto t : *ans) res += t;
  cout << res;
}
