#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MAXN = 1.1e5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<vector<int> > trie;
  int root = 0;
  trie.push_back(vector<int>(26, -1));
  vector<bool> has(n);
  auto AddNode = [&]() -> int {
    trie.push_back(vector<int>(26, -1));
    has.push_back(false);
    return trie.size() - 1;
  };
  auto Insert = [&](const string& s) {
    int cur = root;
    for (int i = 0; i < s.size(); i++) {
      if (trie[cur][s[i] - 'a'] == -1) {
        int nxt = AddNode();
        trie[cur][s[i] - 'a'] = nxt;
      }
      cur = trie[cur][s[i] - 'a'];
    }
    has[cur] = true;
  };
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    Insert(s);
  }
  using PQ = priority_queue<int>;
  function<PQ(int, int)> DFS = [&](int cur, int d) {
    PQ ans;
    for (int i = 0; i < 26; i++) {
      if (trie[cur][i] == -1) continue;
      PQ q = DFS(trie[cur][i], d + 1);
      if (ans.size() < q.size()) ans.swap(q);
      while (!q.empty()) {
        ans.push(q.top());
        q.pop();
      }
    }
    if (has[cur]) {
      ans.push(d);
      return ans;
    } else if (d > 0) {
      ans.pop();
      ans.push(d);
    }
    return ans;
  };
  PQ q = DFS(root, 0);
  long long ans = 0;
  while (!q.empty()) {
    ans += q.top();
    q.pop();
  }
  cout << ans << '\n';
  return 0;
}
