#include <bits/stdc++.h>
using namespace std;
int ch[200010][26], cnt, siz[200010], dep[200010];
multiset<int> st[200010];
int n;
char s[100010];
void insert() {
  int now = 0, len = strlen(s + 1);
  for (int i = 1; i <= len; i++) {
    int qwq = s[i] - 'a';
    if (!ch[now][qwq]) {
      ch[now][qwq] = ++cnt;
      dep[cnt] = dep[now] + 1;
    }
    now = ch[now][qwq];
  }
  siz[now]++;
}
void solve(int u) {
  if (siz[u] > 0) {
    st[u].insert(dep[u]);
  }
  for (int i = 0; i < 26; i++) {
    int v = ch[u][i];
    if (!v) {
      continue;
    }
    solve(v);
    if (st[u].size() < st[v].size()) {
      swap(st[u], st[v]);
    }
    multiset<int>::iterator it = st[v].begin();
    while (it != st[v].end()) {
      st[u].insert((*it));
      ++it;
    }
    st[v].clear();
  }
  if (u != 0 && siz[u] == 0) {
    multiset<int>::iterator it = st[u].end();
    --it;
    st[u].erase(it);
    st[u].insert(dep[u]);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    insert();
  }
  solve(0);
  int ans = 0;
  multiset<int>::iterator it = st[0].begin();
  while (it != st[0].end()) {
    ans += (*it);
    ++it;
  }
  cout << ans;
}
