#include <bits/stdc++.h>
using namespace std;
typedef multiset<int>* pset;
class Trie {
 public:
  bool existed;
  int next[26];
};
void insert(char* s);
pset dfs(int u, int depth);
pset merge(pset a, pset b);
const int MAX = 1e5 + 5;
Trie* const trie = new Trie[MAX];
int trcnt;
char mode[MAX];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(trie, 0, 2 * sizeof(Trie));
    trcnt = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%s", mode);
      insert(mode);
    }
    pset p = dfs(0, 0);
    int res = 0;
    for (auto x : *p) {
      res += x;
    }
    printf("%d\n", res);
  }
  return 0;
}
void insert(char* s) {
  int index = 0;
  for (int i = 0; s[i] != '\0'; i++) {
    int& pos = trie[index].next[s[i] - 'a'];
    if (!pos) {
      pos = ++trcnt;
      memset(&trie[pos], 0, sizeof(Trie));
    }
    index = pos;
  }
  trie[index].existed = true;
}
pset dfs(int u, int depth) {
  pset p = new multiset<int>;
  for (int i = 0; i < 26; i++) {
    int v = trie[u].next[i];
    if (v != 0) {
      auto* np = dfs(v, depth + 1);
      p = merge(p, np);
    }
  }
  if (trie[u].existed) {
    p->insert(depth);
  } else if (depth > 0) {
    p->erase(prev(p->end()));
    p->insert(depth);
  }
  return p;
}
pset merge(pset a, pset b) {
  for (auto x : *b) {
    a->insert(x);
  }
  delete b;
  return a;
}
