#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &v) {
  os << "(";
  os << v.first << "," << v.second << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  long long sz = v.size();
  for (long long i = 0; i < sz; ++i) {
    os << v[i];
    if (i != sz - 1) os << ",";
  }
  os << "]\n";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &v) {
  T last = *v.rbegin();
  os << "[";
  for (auto it : v) {
    os << it;
    if (it != last) os << ",";
  }
  os << "]\n";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const map<T, S> &v) {
  for (auto it : v) {
    os << it.first << " : " << it.second << "\n";
  }
  return os;
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % 1000000007;
    }
    b /= 2;
    a = (a * a) % 1000000007;
  }
  return res;
}
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
struct node {
  long long depth;
  multiset<long long> arr;
  node *link[26];
  bool ended;
};
node *root;
void insert(string &str) {
  long long len = str.size();
  node *curr = root;
  for (long long i = 0; i < len; ++i) {
    long long idx = str[i] - 'a';
    if (curr->link[idx] == NULL) {
      curr->link[idx] = new node();
    }
    curr = curr->link[idx];
  }
  curr->ended = true;
}
multiset<long long> MergeSets(multiset<long long> &arr,
                              multiset<long long> &brr) {
  multiset<long long> res;
  if (arr.size() > brr.size()) {
    res = arr;
    for (auto it : brr) res.insert(it);
    return res;
  }
  res = brr;
  for (auto it : arr) res.insert(it);
  return res;
}
void walk(node *curr, long long depth) {
  if (curr == NULL) return;
  for (long long i = 0; i < 26; ++i) {
    walk(curr->link[i], depth + 1);
  }
  auto &currSet = curr->arr;
  currSet.clear();
  for (long long i = 0; i < 26; ++i) {
    if (curr->link[i] == NULL) continue;
    currSet = MergeSets(currSet, curr->link[i]->arr);
  }
  if (depth && !curr->ended) {
    long long val = *currSet.rbegin();
    currSet.erase(currSet.find(val));
  }
  if (depth) currSet.insert(depth);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string str;
  root = new node();
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> str;
    insert(str);
  }
  walk(root, 0);
  long long ans = 0;
  for (auto it : root->arr) {
    ans = ans + it;
  }
  cout << ans << endl;
  return 0;
}
