#include <bits/stdc++.h>
using namespace std;
int n, i, ans, SIZE, ind[200000], depth[200000];
string st[200000];
multiset<int> s[200000];
struct node {
  int c[30], term;
  node() {
    fill(c, c + 30, -1);
    term = 0;
  }
} t[200000];
void add(string s) {
  int v = 0, i;
  for (i = 0; i < s.size(); i++) {
    int x = s[i] - 'a';
    if (t[v].c[x] == -1) {
      t[v].c[x] = ++SIZE;
    }
    v = t[v].c[x];
  }
  t[v].term++;
}
void Merge(int a, int b) {
  multiset<int>::iterator it = s[b].begin();
  while (it != s[b].end()) {
    s[a].insert(*it);
    ++it;
  }
  s[b].clear();
}
void dfs(int v) {
  int i, to;
  ind[v] = v;
  for (i = 0; i < t[v].term; i++) s[v].insert(depth[v]);
  for (i = 0; i < 26; i++) {
    to = t[v].c[i];
    if (to == -1) continue;
    depth[to] = depth[v] + 1;
    dfs(to);
    if (s[ind[v]].size() < s[ind[to]].size())
      Merge(ind[v], ind[to]);
    else
      Merge(ind[to], ind[v]), ind[v] = ind[to];
  }
  if (v != 0 && !t[v].term) {
    s[ind[v]].erase(--s[ind[v]].end());
    s[ind[v]].insert(depth[v]);
  }
}
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> st[i];
    add(st[i]);
  }
  dfs(0);
  multiset<int>::iterator it = s[ind[0]].begin();
  while (it != s[ind[0]].end()) ans += *it, ++it;
  cout << ans;
  return 0;
}
