#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 1e9 + 9;
const long long maxn = 4e5 + 7;
const double pi = acos(-1.0);
const double eps = 0.00000001;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T powMM(T a, T b) {
  T ret = 1;
  for (; b; b >>= 1ll, a = (long long)a * a % M)
    if (b & 1) ret = (long long)ret * a % M;
  return ret;
}
int n, m, q;
int nxt[maxn][26], tot;
int dep[maxn];
multiset<int> have[maxn];
long long ans;
void ins(char A[]) {
  int p = 0, i, len = strlen(A);
  for (i = 0; i < len; i++) {
    int c = A[i] - 'a';
    if (!nxt[p][c]) {
      nxt[p][c] = ++tot;
      dep[tot] = dep[p] + 1;
    }
    p = nxt[p][c];
  }
  have[p].insert(len);
}
void dfs(int x) {
  int mark = have[x].size(), i;
  for (i = 0; i < 26; i++)
    if (nxt[x][i]) {
      int v = nxt[x][i];
      dfs(v);
      if (have[x].size() < have[v].size()) swap(have[x], have[v]);
      for (int t : have[v]) have[x].insert(t);
      have[v].clear();
    }
  if (x && !mark) {
    multiset<int>::iterator it = have[x].end();
    it--;
    have[x].erase(it);
    have[x].insert(dep[x]);
  }
}
char A[maxn];
int main() {
  int i, j, k, t;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%s", A);
    ins(A);
  }
  dfs(0);
  for (int v : have[0]) ans += v;
  printf("%I64d\n", ans);
  return 0;
}
