#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100005;
char S[MAX_N];
int ans, size;
int tire[MAX_N][26], deep[MAX_N], word[MAX_N];
map<int, int> mp[MAX_N];
map<int, int>::iterator it;
void insert() {
  int len = strlen(S);
  ans += len;
  int id, p = 0;
  for (int i = 0; i < len; i++) {
    id = S[i] - 'a';
    if (!tire[p][id]) {
      tire[p][id] = ++size;
    }
    p = tire[p][id];
    deep[p] = i + 1;
  }
  word[p]++;
}
void dfs(int p) {
  int to;
  for (int i = 0; i < 26; i++) {
    if (tire[p][i]) {
      to = tire[p][i], dfs(to);
      if (mp[to].size() > mp[p].size()) {
        swap(mp[to], mp[p]);
      }
      for (it = mp[to].begin(); it != mp[to].end(); ++it) {
        mp[p][it->first] += it->second;
      }
      mp[to].clear();
    }
  }
  if (word[p]) {
    mp[p][deep[p]] += word[p];
  } else if (p) {
    it = --mp[p].lower_bound(1e6);
    ans -= it->first - deep[p];
    if (!(--it->second)) mp[p].erase(it);
    mp[p][deep[p]]++;
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", S);
    insert();
  }
  dfs(0);
  printf("%d\n", ans);
  return 0;
}
