#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T, class U>
using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
constexpr ll MOD = 1000000007;
constexpr ll HIGHINF = (ll)1e18;
constexpr int INF = 1e9;
constexpr int ALPHABET_SIZE = 26;
struct TrieNode {
  struct TrieNode *children[ALPHABET_SIZE];
  bool is_end_of_word;
};
struct TrieNode *getNode(void) {
  struct TrieNode *p_node = new TrieNode;
  p_node->is_end_of_word = false;
  for (int i = 0; i < ALPHABET_SIZE; i++) p_node->children[i] = nullptr;
  return p_node;
}
void insert(struct TrieNode *root, string key) {
  struct TrieNode *p_crawl = root;
  for (int i = 0; i < key.size(); i++) {
    int idx = key[i] - 'a';
    if (!p_crawl->children[idx]) p_crawl->children[idx] = getNode();
    p_crawl = p_crawl->children[idx];
  }
  p_crawl->is_end_of_word = true;
}
bool search(struct TrieNode *root, string key) {
  struct TrieNode *p_crawl = root;
  for (int i = 0; i < key.size(); i++) {
    int idx = key[i] - 'a';
    if (!p_crawl->children[idx]) return false;
    p_crawl = p_crawl->children[idx];
  }
  return (p_crawl != nullptr && p_crawl->is_end_of_word);
}
bool isEmpty(TrieNode *root) {
  for (int i = 0; i < ALPHABET_SIZE; i++)
    if (root->children[i]) return false;
  return true;
}
TrieNode *remove(TrieNode *root, string key, int depth = 0) {
  if (!root) return nullptr;
  if (depth == key.size()) {
    if (root->is_end_of_word) root->is_end_of_word = false;
    if (isEmpty(root)) {
      delete (root);
      root = nullptr;
    }
    return root;
  }
  int idx = key[depth] - 'a';
  root->children[idx] = remove(root->children[idx], key, depth + 1);
  if (isEmpty(root) && (!root->is_end_of_word)) {
    delete (root);
    root = nullptr;
  }
  return root;
}
multiset<int> merge(multiset<int> a, multiset<int> b) {
  if (a.size() > b.size()) swap(a, b);
  for (auto t : a) b.insert(t);
  return b;
}
multiset<int> calc(TrieNode *cur, int curd) {
  multiset<int> ans;
  for (int i = 0; i < ALPHABET_SIZE; i++) {
    if (cur->children[i]) {
      auto t = calc(cur->children[i], curd + 1);
      ans = merge(ans, t);
    }
  }
  if (cur->is_end_of_word) {
    ans.insert(curd);
  } else if (curd != 0) {
    ans.erase(prev(ans.end()));
    ans.insert(curd);
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  V<string> s(n);
  for (int i = 0; i < n; i++) cin >> s[i];
  struct TrieNode *root = getNode();
  for (int i = 0; i < n; i++) insert(root, s[i]);
  auto ans = calc(root, 0);
  int total = 0;
  for (auto t : ans) {
    total += t;
  }
  cout << total << '\n';
  return 0;
}
