#include <bits/stdc++.h>
using namespace std;
struct node {
  node* child[26];
  priority_queue<int> pq;
  bool leaf;
  node() {
    memset(child, 0, sizeof child);
    leaf = false;
  }
};
void insert(node* curr, const string& x) {
  for (auto c : x) {
    if (!curr->child[c - 'a']) curr->child[c - 'a'] = new node();
    curr = curr->child[c - 'a'];
  }
  curr->leaf = true;
}
void dfs(node* curr, int lev) {
  for (int i = 0; i < 26; i++) {
    if (!curr->child[i]) continue;
    dfs(curr->child[i], lev + 1);
    while (!curr->child[i]->pq.empty())
      curr->pq.push(curr->child[i]->pq.top()), curr->child[i]->pq.pop();
  }
  if (curr->leaf)
    curr->pq.push(lev);
  else {
    if (!curr->pq.empty() && lev) curr->pq.pop(), curr->pq.push(lev);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  node* root = new node();
  while (n--) {
    string x;
    cin >> x;
    insert(root, x);
  }
  dfs(root, 0);
  long long ans = 0;
  while (!root->pq.empty()) ans += root->pq.top(), root->pq.pop();
  cout << ans << '\n';
  return 0;
}
