#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, trie[maxn][26], en[maxn], nxt;
string s;
void ins(int cur, int i) {
  if (i == (int)s.size())
    en[cur] = 1;
  else {
    int le = (s[i] - 'a');
    if (!trie[cur][le]) trie[cur][le] = ++nxt;
    ins(trie[cur][le], i + 1);
  }
}
multiset<int> merge(multiset<int> a, multiset<int> b) {
  if ((int)a.size() < (int)b.size()) swap(a, b);
  for (auto aa : b) a.insert(aa);
  return a;
}
multiset<int> dfs(int cur, int dep) {
  multiset<int> ret;
  for (int i = 0; i < 26; i++)
    if (trie[cur][i]) ret = merge(ret, dfs(trie[cur][i], dep + 1));
  if (en[cur])
    ret.insert(dep);
  else if (cur != 0) {
    int a = *prev(ret.end());
    ret.erase(prev(ret.end()));
    ret.insert(dep);
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    ins(0, 0);
  }
  multiset<int> res = dfs(0, 0);
  long long ans = 0;
  for (auto a : res) ans += a;
  cout << ans << "\n";
  return 0;
}
