#include <bits/stdc++.h>
using namespace std;
const int MxN = 1e5 + 1;
struct TrieNode {
  TrieNode *nxt[26];
  bool end;
  TrieNode() {
    for (int i = 0; i < 26; ++i) {
      nxt[i] = nullptr;
    }
    end = false;
  }
};
TrieNode *head = new TrieNode();
void add(string s) {
  TrieNode *cur = head;
  int n = s.length();
  for (int i = 0; i < n; ++i) {
    int v = s[i] - 'a';
    if (cur->nxt[v] == nullptr) {
      cur->nxt[v] = new TrieNode();
    }
    cur = cur->nxt[v];
  }
  cur->end = true;
}
struct Node {
  int val;
  bool operator<(Node oth) const { return val > oth.val; }
};
void merge(multiset<Node> &a, multiset<Node> b) {
  for (Node v : b) {
    a.insert(v);
  }
}
multiset<Node> dfs(TrieNode *cur, int depth) {
  multiset<Node> s;
  for (int i = 0; i < 26; ++i) {
    if (!cur->nxt[i]) continue;
    merge(s, dfs(cur->nxt[i], depth + 1));
  }
  if (depth) {
    Node k;
    k.val = depth;
    s.insert(k);
    if (!cur->end) {
      s.erase(s.begin());
    }
  }
  return s;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    add(s);
  }
  multiset<Node> S = dfs(head, 0);
  int res = 0;
  for (Node a : S) {
    res += a.val;
  }
  cout << res << '\n';
  return 0;
}
