#include <bits/stdc++.h>
using namespace std;
const int N = 100010, M = 26;
struct trie {
  int v = 0;
  struct trie *go[M];
  trie() {
    for (int i = 0; i < M; i++) go[i] = NULL;
  }
} * root, *temp;
int nxt = 1;
void add(string s) {
  int n = s.size();
  temp = root;
  for (int i = 0; i < n; i++) {
    if (!temp->go[s[i] - 'a']) temp->go[s[i] - 'a'] = new trie();
    temp = temp->go[s[i] - 'a'];
  }
  temp->v = 1;
}
multiset<int> merge(multiset<int> x, multiset<int> y) {
  if (x.size() < y.size()) {
    for (int z : x) y.insert(z);
    return y;
  }
  for (int z : y) x.insert(z);
  return x;
}
multiset<int> dfs(trie temp, int h) {
  multiset<int> ans;
  for (int i = 0; i < M; i++) {
    if (!temp.go[i]) continue;
    multiset<int> ans2 = dfs(*temp.go[i], h + 1);
    ans = merge(ans, ans2);
  }
  if (temp.v) {
    ans.insert(h);
    return ans;
  }
  if (h == 0) return ans;
  if (ans.size()) ans.erase(prev(ans.end()));
  ans.insert(h);
  return ans;
}
int main() {
  root = new trie();
  int n;
  cin >> n;
  string s;
  map<string, int> m;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    m[s] = i;
  }
  long long res = 0;
  for (auto x : m) add(x.first);
  multiset<int> ans = dfs(*root, 0);
  cout << accumulate(ans.begin(), ans.end(), 0);
  return 0;
}
