#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
void JIZZ(string output = "") {
  cout << output;
  exit(0);
}
const long double PI = 3.14159265358979323846264338327950288;
const long double eps = 1e-13;
const long long mod = 1e9 + 7;
struct node {
  node *ch[26];
  int sz;
  bool end;
  int gsz(int i) { return ch[i] ? ch[i]->sz : 0; }
  node() : sz(0), end(0) { memset(ch, 0, sizeof(ch)); }
} * root;
string s[100005];
long long ans;
void ins(node *&now, string &s, int ptr) {
  if (!now) now = new node();
  ++now->sz;
  if (ptr >= s.size()) {
    now->end = 1;
    return;
  }
  ins(now->ch[s[ptr] - 'a'], s, ptr + 1);
}
priority_queue<int, vector<int>, less<int>> *dfs(node *now, int dep) {
  if (!now) return new priority_queue<int, vector<int>, less<int>>;
  priority_queue<int, vector<int>, less<int>> *rt =
      new priority_queue<int, vector<int>, less<int>>;
  for (int i = 0; i < 26; ++i) {
    auto *t = dfs(now->ch[i], dep + 1);
    if (t->size() > rt->size()) swap(t, rt);
    while (t->size()) {
      rt->push(t->top());
      t->pop();
    }
    delete t;
  }
  if (now->end)
    rt->push(dep);
  else if (rt->size()) {
    rt->pop();
    rt->push(dep);
  }
  return rt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> s[i];
  for (int i = 1; i <= n; ++i) ins(root, s[i], 0);
  long long ans = 0;
  for (int i = 0; i < 26; ++i)
    if (root->ch[i]) {
      auto *pq = dfs(root->ch[i], 1);
      while (pq->size()) {
        ans += pq->top();
        pq->pop();
      }
      delete pq;
    }
  cout << ans << endl;
}
