#include <bits/stdc++.h>
using namespace std;
struct trie {
  long long cnt = 0;
  trie *child[26];
};
trie *root;
void insert(string &s) {
  trie *cur = root;
  for (auto i : s) {
    if (!cur->child[i - 'a']) cur->child[i - 'a'] = new trie();
    cur = cur->child[i - 'a'];
    cur->cnt++;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  long long t, n, i, j, c, m, x, f, l, ans;
  root = new trie();
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> s;
    insert(s);
  }
  ans = 0;
  trie *u;
  trie *y;
  map<trie *, long long> level;
  map<trie *, trie *> mp;
  map<trie *, long long> vis;
  root->cnt = 10000000000;
  for (j = 0; j < 26; j++) {
    if (root->child[j] == NULL) continue;
    trie *curr = root->child[j];
    mp[curr] = root;
    x = curr->cnt;
    queue<trie *> q;
    q.push(curr);
    level[curr] = 1;
    while (!q.empty()) {
      if (x == 0) break;
      u = q.front();
      q.pop();
      y = u;
      f = 1;
      while (y != root) {
        if (y->cnt == 0) {
          f = 0;
          break;
        }
        y = mp[y];
      }
      if (f == 0) continue;
      x--;
      ans += level[u];
      y = u;
      while (y != root) {
        y->cnt--;
        y = mp[y];
      }
      for (i = 0; i < 26; i++) {
        y = u->child[i];
        if (u->child[i] == NULL || vis.count(y)) continue;
        level[y] = level[u] + 1;
        mp[y] = u;
        vis[y] = 1;
        q.push(y);
      }
    }
  }
  cout << ans;
  return 0;
}
