#include <bits/stdc++.h>
using namespace std;
struct node {
  char c;
  vector<node*> v;
  bool tag;
  node() {
    v.clear();
    tag = false;
  }
}* root = new node();
struct cmp {
  bool operator()(int a, int b) { return a > b; }
};
void add(string str) {
  node *p = root, *q;
  int i, j, k;
  for (i = 0; i < str.size(); i++) {
    for (j = 0; j < p->v.size(); j++) {
      if (p->v[j]->c == str[i]) break;
    }
    if (j == p->v.size()) {
      q = new node();
      q->c = str[i];
      p->v.push_back(q);
      p = q;
    } else {
      p = p->v[j];
    }
  }
  p->tag = true;
}
multiset<int, cmp> dfs(node* p, int depth) {
  multiset<int, cmp> s, s1;
  int i, j;
  for (i = 0; i < p->v.size(); i++) {
    s1 = dfs(p->v[i], depth + 1);
    s.insert(s1.begin(), s1.end());
  }
  if (p != root) {
    if (p->tag)
      s.insert(depth);
    else {
      if (!s.empty()) {
        s.erase(s.begin());
        s.insert(depth);
      }
    }
  }
  return s;
}
int main() {
  int n, i, j;
  string str;
  cin >> n;
  getchar();
  for (i = 1; i <= n; i++) {
    getline(cin, str);
    add(str);
  }
  multiset<int, cmp> s = dfs(root, 0);
  int ans = 0;
  for (auto a : s) ans += a;
  cout << ans << endl;
  return 0;
}
