#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
map<char, int> trie[N];
vector<int> g[N];
int t[N];
int ans = 0;
void add(string &s) {
  static int cntv = 1;
  int v = 0;
  for (int i = 0; i < s.size(); ++i) {
    if (!trie[v].count(s[i])) {
      g[v].push_back(trie[v][s[i]] = cntv++);
    }
    v = trie[v][s[i]];
  }
  t[v] = 1;
}
void scan() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    add(s);
    ans += s.size();
  }
}
int sz[N];
int par[N];
int ind[N];
set<pair<int, int>, greater<pair<int, int>>> dp[N];
int delta[N];
void dfs(int v) {
  sz[v] = 1;
  if (g[v].empty()) {
    dp[ind[v] = v].insert({1, v});
  } else {
    int bu = g[v][0];
    for (int u : g[v]) {
      dfs(u);
      sz[v] += sz[u];
      par[u] = v;
      if (sz[bu] < sz[u]) {
        bu = u;
      }
    }
    ind[v] = ind[bu];
    for (int u : g[v]) {
      if (u != bu) {
        for (auto e : dp[ind[u]]) {
          dp[ind[v]].insert(
              {e.first + delta[ind[u]] - delta[ind[v]], e.second});
        }
      }
    }
    if (t[v]) {
      ++delta[ind[v]];
    } else {
      auto e = *dp[ind[v]].begin();
      dp[ind[v]].erase(dp[ind[v]].begin());
      ans -= e.first-- + delta[ind[v]]++;
      e.second = par[e.second];
      dp[ind[v]].insert(e);
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  scan();
  for (int v : g[0]) {
    dfs(v);
  }
  cout << ans << '\n';
  return 0;
}
