#include <bits/stdc++.h>
using namespace std;
struct cc {
  map<char, int> next;
  int term = 0;
  int d = 0;
};
int sz = 1;
cc t[100010];
void add_string(const string &s) {
  int v = 0;
  for (size_t i = 0; i < s.size(); ++i) {
    char c = s[i];
    if (t[v].next.find(c) == t[v].next.end()) {
      t[v].next[c] = sz++;
    }
    v = t[v].next[c];
    t[v].d = i + 1;
  }
  t[v].term = true;
}
void mer(multiset<int> &f, multiset<int> &s) {
  if (f.size() < s.size()) swap(f, s);
  for (auto it : s) {
    f.insert(it);
  }
  s.clear();
}
multiset<int> dfs(int v) {
  multiset<int> ans;
  for (auto it : t[v].next) {
    auto now = dfs(it.second);
    mer(ans, now);
  }
  if (t[v].term) {
    ans.insert(t[v].d);
  } else if (ans.size() && *ans.rbegin() > t[v].d) {
    ans.insert(t[v].d);
    ans.erase(--ans.end());
  }
  return move(ans);
}
signed main() {
  int n;
  cin >> n;
  t[0].term = 1;
  for (int i = 1; i <= n; ++i) {
    string s;
    cin >> s;
    add_string(s);
  }
  auto gg = dfs(0);
  int ans = 0;
  for (auto it : gg) {
    ans += it;
  }
  cout << ans << endl;
}
