#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
namespace Trie {
int c[N][26], size = 1;
bool flag[N];
multiset<int> g[N];
inline void Append(char *s) {
  int p = 1;
  for (int d; d = *s - 'a', *s; ++s) p = !c[p][d] ? c[p][d] = ++size : c[p][d];
  flag[p] = 1;
}
inline void Merge(multiset<int> &a, multiset<int> &b) {
  if (a.size() < b.size()) a.swap(b);
  for (multiset<int>::iterator it = b.begin(); it != b.end(); ++it)
    a.insert(*it);
}
inline void Solve(int x = 1, int de = 0) {
  for (int d = 0; d < 26; ++d)
    if (c[x][d]) Solve(c[x][d], de + 1), Merge(g[x], g[c[x][d]]);
  if (flag[x]) {
    g[x].insert(de);
  } else if (x != 1) {
    g[x].insert(de);
    g[x].erase(--g[x].end());
  }
}
}  // namespace Trie
int n;
char s[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s);
    Trie::Append(s);
  }
  Trie::Solve();
  multiset<int> ans(Trie::g[1]);
  int sum = 0;
  for (multiset<int>::iterator it = ans.begin(); it != ans.end(); ++it)
    sum += *it;
  printf("%d\n", sum);
  return 0;
}
