#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int maxn = 1e5 + 11;
const int maxc = 26;
int N, M, T, P, Q;
struct Trie {
  int ch[maxn][maxc];
  int val[maxn];
  int sz;
  Trie() {
    sz = 1;
    memset(ch[0], 0, sizeof(ch[0]));
    val[0] = 1;
  }
  int idx(char c) { return c - 'a'; }
  void add(char* s, int v) {
    int u = 0, n = strlen(s);
    for (int i = 0; i < n; i++) {
      int c = idx(s[i]);
      if (!ch[u][c]) {
        memset(ch[sz], 0, sizeof(ch[sz]));
        val[sz] = 0;
        ch[u][c] = sz++;
      }
      u = ch[u][c];
    }
    val[u] = v;
  }
  int diff = 0;
  priority_queue<int> dfs(int u = 0, int dep = 0) {
    ((void)0);
    priority_queue<int> qu, qv;
    for (int i = 0; i < maxc; i++) {
      int v = ch[u][i];
      if (v) qv = dfs(v, dep + 1);
      while (qv.size()) {
        int x = qv.top();
        qv.pop();
        qu.push(x);
      }
    }
    if (!val[u]) {
      val[u] = 1;
      int x = qu.top();
      qu.pop();
      diff += x - dep;
    }
    qu.push(dep);
    return qu;
  }
} trie;
int main() {
  cin >> N;
  int tot = 0;
  char s[maxn];
  for (int i = 0; i < N; i++) {
    scanf("%s", s);
    tot += strlen(s);
    trie.add(s, 1);
  }
  trie.dfs();
  cout << tot - trie.diff << endl;
  return 0;
}
