#include <bits/stdc++.h>
using namespace std;
class Trie {
 public:
  Trie *f[26];
  bool leaf;
  Trie() {
    for (int i = 0; i < 26; i++) f[i] = nullptr;
    leaf = 0;
  }
  void add(Trie *t, string s) {
    string x;
    int len = 0;
    for (char a : s) {
      if (t->f[a - 'a'] == nullptr) t->f[a - 'a'] = new Trie();
      t = t->f[a - 'a'];
    }
    t->leaf = 1;
  }
  multiset<int> *merge(multiset<int> *a, multiset<int> *b) {
    if (a->size() < b->size()) swap(a, b);
    for (auto it : *b) a->insert(it);
    delete b;
    return a;
  }
  multiset<int> *solve(Trie *t, int len = 0) {
    multiset<int> *ans = new multiset<int>;
    for (int i = 0; i < 26; i++) {
      if (t->f[i] == nullptr) continue;
      multiset<int> *m = solve(t->f[i], len + 1);
      ans = merge(ans, m);
    }
    if (t->leaf)
      ans->insert(len);
    else if (len) {
      ans->erase(prev(ans->end()));
      ans->insert(len);
    }
    return ans;
  }
} trie;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  Trie *root = new Trie();
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    trie.add(root, s);
  }
  multiset<int> *ans = trie.solve(root);
  long long sum = 0;
  for (auto v : *ans) sum += v;
  cout << sum << "\n";
  return 0;
}
