#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int Next[N][26];
bool vis[N];
int rt, tot, n;
void insert(string s) {
  int len = s.size();
  int nd = rt;
  for (int i = 0; i < len; i++) {
    if (!Next[nd][s[i] - 'a']) Next[nd][s[i] - 'a'] = ++tot;
    nd = Next[nd][s[i] - 'a'];
  }
  vis[nd] = 1;
}
multiset<int> s[N];
void dfs(int k, int dep) {
  int hs = k, d = 0;
  for (int i = 0; i < 26; i++)
    if (Next[k][i]) {
      int y = Next[k][i];
      dfs(y, dep + 1);
    }
  for (int i = 0; i < 26; i++) {
    int y = Next[k][i];
    if (!y) continue;
    for (auto x : s[y]) s[k].insert(x);
  }
  if (vis[k]) s[k].insert(dep);
  if (!vis[k] && dep) {
    s[k].erase(prev(s[k].end()));
    s[k].insert(dep);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    string s;
    cin >> s;
    insert(s);
  }
  dfs(0, 0);
  long long sum = 0;
  for (auto x : s[0]) sum += x;
  cout << sum;
}
