#include <bits/stdc++.h>
using namespace std;
struct Node {
  Node* child[26];
  bool end;
  Node() {
    for (int i = 0; i < 26; i++) child[i] = NULL;
    end = false;
  }
} root;
void add(Node* node, string& s, int i) {
  if (i == s.length())
    node->end = true;
  else {
    int t = s[i] - 'a';
    if (node->child[t] == NULL) node->child[t] = new Node;
    add(node->child[t], s, i + 1);
  }
}
void swap(multiset<int>& a, multiset<int>& b) {
  multiset<int> tmp = a;
  a = b;
  b = tmp;
}
multiset<int> merge(multiset<int>& a, multiset<int>& b) {
  if (a.size() > b.size()) swap(a, b);
  for (multiset<int>::iterator it = a.begin(); it != a.end(); ++it)
    b.insert(*it);
  return b;
}
multiset<int> dfs(Node* node, int d) {
  multiset<int> res;
  for (int i = 0; i < 26; i++) {
    if (node->child[i] != NULL) {
      multiset<int> tmp = dfs(node->child[i], d + 1);
      res = merge(res, tmp);
    }
  }
  if (node->end)
    res.insert(d);
  else if (d > 0) {
    res.erase(prev(res.end()));
    res.insert(d);
  }
  return res;
}
void solve() {
  multiset<int> res = dfs(&root, 0);
  int ans = 0;
  for (multiset<int>::iterator it = res.begin(); it != res.end(); ++it) {
    ans += *it;
  }
  cout << ans << endl;
}
int main() {
  int n;
  cin >> n;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    add(&root, s, 0);
  }
  solve();
  return 0;
}
