#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int arrCount = 26;
struct Node {
  int deep;
  bool endi;
  Node* arr[arrCount];
  Node(int d) {
    endi = 0;
    deep = d;
    for (int i = 0; i < arrCount; i++) arr[i] = nullptr;
  }
};
class NodeTree {
 private:
  Node* first;

 public:
  NodeTree() { first = new Node(0); }
  void add(string str) {
    Node* cur = first;
    int deep = 0;
    for (int i = 0; i < str.length(); i++) {
      int ch = (int)str[i] - 97;
      deep++;
      if (!(cur->arr[ch])) {
        cur->arr[ch] = new Node(deep);
      }
      cur = cur->arr[ch];
    }
    cur->endi = 1;
  }
  void findAns(Node* cur, priority_queue<int>& q) {
    for (int i = 0; i < arrCount; i++)
      if (cur->arr[i]) {
        priority_queue<int> q1;
        findAns(cur->arr[i], q1);
        if (q1.size() > q.size()) q1.swap(q);
        while (!q1.empty()) {
          q.push(q1.top());
          q1.pop();
        }
      }
    if (cur->endi) {
      q.push(cur->deep);
    } else {
      q.pop();
      q.push(cur->deep);
    }
  }
  int findAns() {
    int res = 0;
    for (int i = 0; i < arrCount; i++)
      if (first->arr[i]) {
        priority_queue<int> q;
        findAns(first->arr[i], q);
        while (!q.empty()) {
          res += q.top();
          q.pop();
        }
      }
    return res;
  }
  ~NodeTree() {
    queue<Node*> q;
    q.push(first);
    while (!q.empty()) {
      Node* cur = q.front();
      q.pop();
      for (int i = 0; i < arrCount; i++)
        if (cur->arr[i]) q.push(cur->arr[i]);
      delete cur;
    }
  }
};
int main() {
  int n;
  NodeTree tree;
  cin >> n;
  string str;
  for (int i = 0; i < n; i++) {
    cin >> str;
    tree.add(str);
  }
  cout << tree.findAns() << endl;
  return 0;
}
