#include <bits/stdc++.h>
using namespace std;
void add(const string& s, vector<vector<int>>& trie, int depth = 0,
         int curr = 0) {
  if (s.size() == depth) {
    ++trie[curr].back();
    return;
  }
  if (trie[curr][s[depth] - 'a'] == -1) {
    trie.push_back(vector<int>(27, -1));
    trie.back().back() = 0;
    trie[curr][s[depth] - 'a'] = (int)trie.size() - 1;
  }
  add(s, trie, depth + 1, trie[curr][s[depth] - 'a']);
}
void dfs(int curr, const vector<vector<int>>& trie, vector<int>& dp,
         vector<set<pair<int, int>>>& vert, int depth = 0) {
  int max_s = 0;
  int ind = -1;
  for (int i = 0; i < 26; ++i) {
    if (trie[curr][i] != -1) {
      dfs(trie[curr][i], trie, dp, vert, depth + 1);
      dp[curr] += dp[trie[curr][i]];
      if (vert[trie[curr][i]].size() > max_s) {
        ind = trie[curr][i];
        max_s = vert[trie[curr][i]].size();
      }
    }
  }
  if (ind != -1) {
    swap(vert[curr], vert[ind]);
  }
  if (trie[curr].back() > 0) {
    vert[curr].insert({-depth, curr});
  }
  for (int i = 0; i < 26; ++i) {
    if (trie[curr][i] != -1 && trie[curr][i] != ind) {
      for (const auto& a : vert[trie[curr][i]]) {
        vert[curr].insert(a);
      }
    }
  }
  if (trie[curr].back() > 0) {
    dp[curr] += depth;
  } else if (curr != 0 && !vert[curr].empty()) {
    dp[curr] -= -vert[curr].begin()->first - depth;
    auto cc = *vert[curr].begin();
    vert[curr].erase(vert[curr].begin());
    vert[curr].insert({-depth, cc.second});
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> trie;
  trie.push_back(vector<int>(27, -1));
  trie.back().back() = 0;
  string buff;
  for (int i = 0; i < n; ++i) {
    cin >> buff;
    add(buff, trie);
  }
  vector<int> dp(trie.size(), 0);
  vector<set<pair<int, int>>> vert(trie.size());
  dfs(0, trie, dp, vert);
  cout << dp[0] << "\n";
}
