#include <bits/stdc++.h>
using namespace std;
class node {
 public:
  bool leaf;
  node* ptr[26];
  node() {
    leaf = 0;
    for (long long int i = 0; i < 26; i++) {
      ptr[i] = NULL;
    }
  }
};
node* root;
void add_string(string& s) {
  node* cur = root;
  for (long long int i = 0; i < s.length(); i++) {
    if (cur->ptr[s[i] - 'a'] == NULL) {
      cur->ptr[s[i] - 'a'] = new node();
    }
    cur = cur->ptr[s[i] - 'a'];
  }
  cur->leaf = 1;
}
pair<multiset<long long int>, long long int> dfs(node* cur) {
  multiset<long long int> s1;
  long long int inc = 0;
  if (cur->leaf) {
    s1.insert(1);
    for (long long int i = 0; i < 26; i++) {
      if (cur->ptr[i]) {
        pair<multiset<long long int>, long long int> s2 = dfs(cur->ptr[i]);
        if (s1.size() > s2.first.size()) {
          for (auto it : s2.first) {
            s1.insert(it + 1ll + s2.second - inc);
          }
        } else {
          s2.second += 1ll;
          for (auto it : s1) {
            s2.first.insert(it + inc - s2.second);
          }
          swap(s1, s2.first);
          inc = s2.second;
        }
      }
    }
  } else {
    for (long long int i = 0; i < 26; i++) {
      if (cur->ptr[i]) {
        pair<multiset<long long int>, long long int> s2 = dfs(cur->ptr[i]);
        if (s1.size() > s2.first.size()) {
          for (auto it : s2.first) {
            s1.insert(it + s2.second - inc);
          }
        } else {
          for (auto it : s1) {
            s2.first.insert(it + inc - s2.second);
          }
          swap(s1, s2.first);
          inc = s2.second;
        }
      }
    }
    inc += 1ll;
    auto it = *s1.rbegin();
    s1.insert(1ll - inc);
    s1.erase(s1.lower_bound(it));
  }
  return {s1, inc};
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  root = new node();
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    string s;
    cin >> s;
    add_string(s);
  }
  long long int res = 0;
  for (long long int i = 0; i < 26; i++) {
    if (root->ptr[i]) {
      pair<multiset<long long int>, long long int> c_ans = dfs(root->ptr[i]);
      for (auto it : c_ans.first) {
        res += it + c_ans.second;
      }
    }
  }
  cout << res << "\n";
}
