#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int arr = 2e5 + 10;
const int ar = 2e3 + 10;
const long double pi = acos(-1);
const long double eps = 1e-10;
const long long md = 1e9 + 7;
multiset<int> b[arr];
int bor[arr][26];
int cnt = 1;
void add(string s) {
  int deep = 0;
  int cur = 1;
  for (auto i : s) {
    deep++;
    if (!bor[cur][i - 'a']) {
      bor[cur][i - 'a'] = ++cnt;
    }
    cur = bor[cur][i - 'a'];
  }
  b[cur].insert(deep);
}
void dfs(int now, int deep = 0) {
  bool can = (b[now].empty() && deep != 0);
  for (int i = 0; i < 26; i++) {
    if (bor[now][i]) {
      int to = bor[now][i];
      dfs(to, deep + 1);
      if ((int)(b[to].size()) > (int)(b[now].size())) {
        b[now].swap(b[to]);
      }
      for (auto i : b[to]) {
        b[now].insert(i);
      }
    }
  }
  if (can && !b[now].empty()) {
    b[now].erase((--b[now].end()));
    b[now].insert(deep);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  while (n--) {
    string s;
    cin >> s;
    add(s);
  }
  dfs(1);
  int ans = 0;
  for (auto i : b[1]) {
    ans += i;
  }
  cout << ans << "\n";
}
