#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n, num;
long long ans;
multiset<int> ms[N];
struct TRIE {
  int sz = 0;
  struct T_node {
    int next[26], cnt = 0;
  } node[N];
  void insert(string &s) {
    int now = 0;
    for (char c : s) {
      if (node[now].next[c - 'a'] == 0) node[now].next[c - 'a'] = ++sz;
      now = node[now].next[c - 'a'];
    }
    node[now].cnt++;
  }
} tree;
void dfs(int u, int lev) {
  for (int c = 0; c < 26; c++) {
    int v = tree.node[u].next[c];
    if (!v) continue;
    dfs(v, lev + 1);
    if (ms[v].size() > ms[u].size()) swap(ms[u], ms[v]);
    for (auto x : ms[v]) ms[u].insert(x);
    ms[v].clear();
  }
  if (tree.node[u].cnt == 0 && ms[u].size()) {
    ms[u].erase(--ms[u].end());
    ms[u].insert(lev);
  } else
    ms[u].insert(lev);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    tree.insert(s);
  }
  tree.node[0].cnt = 1;
  dfs(0, 0);
  for (int x : ms[0]) ans += x;
  cout << ans;
}
