#include <bits/stdc++.h>
using namespace std;
struct node {
  node *next[26];
  long long len, cnt;
  node() {
    for (long long i = 0; i < 26; i++) next[i] = NULL;
    len = cnt = 0;
  }
} * head;
void insert(string s) {
  node *x = head;
  x->cnt++;
  for (auto &i : s) {
    if (x->next[i - 'a'] == NULL) {
      x->next[i - 'a'] = new node();
      x->next[i - 'a']->len = x->len + 1;
    }
    x = x->next[i - 'a'];
    x->cnt++;
  }
}
void getans(node *x, priority_queue<long long> *&p) {
  if (x == NULL) return;
  if (x->cnt == 1) {
    p = new priority_queue<long long>();
    p->push(x->len);
    return;
  }
  long long tot = x->cnt;
  priority_queue<long long> *p2[26];
  long long loc = 0, mxs = 0;
  for (long long i = 0; i < 26; i++) {
    p2[i] = NULL;
    getans(x->next[i], p2[i]);
    if (p2[i] && p2[i]->size() > mxs) mxs = p2[i]->size(), loc = i;
    tot -= x->next[i] ? x->next[i]->cnt : 0;
  }
  for (long long i = 0; i < 26; i++) {
    if (i == loc) continue;
    if (p2[i]) {
      while (p2[i]->size()) {
        p2[loc]->push(p2[i]->top());
        p2[i]->pop();
      }
      delete (p2[i]);
    }
  }
  p = p2[loc];
  if (x != head) {
    if (!tot) p->pop();
    p->push(x->len);
  }
}
int32_t main() {
  head = new node();
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  string s;
  for (long long i = 0; i < n; i++) {
    cin >> s;
    insert(s);
  }
  long long sum = 0;
  priority_queue<long long> *p = NULL;
  for (long long i = 0; i < 26; i++) {
    getans(head->next[i], p);
    if (p) {
      while (p->size()) {
        sum += p->top();
        p->pop();
      }
      delete (p);
      p = NULL;
    }
  }
  cout << sum;
  return 0;
}
