#include <bits/stdc++.h>
using namespace std;
void print() { cout << endl; }
template <typename First, typename... Strings>
void print(First arg, const Strings&... rest) {
  cout << arg << " ";
  print(rest...);
}
template <typename T>
void print(vector<T>& v) {
  for (T x : v) cout << x << " ";
  cout << endl;
}
struct trie {
  bool end;
  trie* next[26];
  trie() {
    end = 0;
    for (long long int i = 0; i < 26; i++) next[i] = NULL;
  }
} * root;
void addString(string s) {
  trie* cur = root;
  for (char c : s) {
    int in = c - 'a';
    if (!cur->next[in]) cur->next[in] = new trie();
    cur = cur->next[in];
  }
  cur->end = 1;
}
multiset<int> merge(multiset<int> a, multiset<int> b) {
  if (a.size() > b.size()) swap(a, b);
  for (auto t : a) b.insert(t);
  return b;
}
multiset<int> query(trie* root, int l) {
  multiset<int> cwr;
  for (long long int i = 0; i < 26; i++) {
    if (root->next[i]) {
      auto c = query(root->next[i], l + 1);
      cwr = merge(cwr, c);
    }
  }
  if (root->end)
    cwr.insert(l);
  else if (l != 0) {
    cwr.erase(prev(cwr.end()));
    cwr.insert(l);
  }
  return cwr;
}
void test_case() {
  long long int n;
  cin >> n;
  root = new trie();
  for (long long int i = 0; i < n; i++) {
    string s;
    cin >> s;
    addString(s);
  }
  auto x = query(root, 0);
  print(accumulate((x).begin(), (x).end(), 0));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t = 1;
  for (long long int i = 0; i < t; i++) {
    test_case();
  }
  return 0;
}
