#include <bits/stdc++.h>
using namespace std;
const int N = 123456;
int cur_id;
struct trie {
  map<char, trie> node;
  bool ends_here;
  int id;
  trie() {
    ends_here = false;
    id = cur_id++;
  }
  void add(const string &word, int i = 0) {
    if (i == word.size()) {
      ends_here = true;
    } else {
      node[word[i]].add(word, i + 1);
    }
  }
};
int id[N];
multiset<int> depths[N];
int merge(int u, int v) {
  if (depths[u].size() < depths[v].size()) {
    swap(u, v);
  }
  for (auto it : depths[v]) {
    depths[u].insert(it);
  }
  return u;
}
void sack(const trie &cur, int parent, int depth = 0) {
  int u = cur.id;
  id[u] = u;
  for (auto &child : cur.node) {
    sack(child.second, u, depth + 1);
  }
  u = id[u];
  if (cur.ends_here) {
    depths[u].insert(depth);
  } else if (depth) {
    depths[u].erase(depths[u].find(*depths[u].rbegin()));
    depths[u].insert(depth);
  }
  if (parent != -1) {
    id[parent] = merge(u, id[parent]);
  }
}
char word[N];
int main() {
  int n;
  trie words;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", word);
    words.add(word);
  }
  sack(words, -1);
  int len = 0;
  for (auto depth : depths[id[0]]) {
    len += depth;
  }
  printf("%d\n", len);
  return 0;
}
