#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int INF = (int)(1e9 + 1e5);
const long long LINF = (long long)(1e18);
const long long MX = 100500;
const double EPS = 1e-9;
const int MOD = 1000000007;
const int BASE = 1000003;
const int MAXN = 100500;
const int SIGMA = 26;
struct node {
  bool finish;
  int cnt;
  int nxt[SIGMA];
};
int n;
char s[MAXN];
int st[MAXN];
vector<priority_queue<int>> qu;
node tre[MAXN];
int vcount = 0;
long long ans;
void add() {
  int v = 0;
  ++tre[v].cnt;
  for (int i = 0; s[i]; ++i) {
    int let = s[i] - 'a';
    if (tre[v].nxt[let] == 0) {
      tre[v].nxt[let] = ++vcount;
    }
    v = tre[v].nxt[let];
    ++tre[v].cnt;
  }
  tre[v].finish = true;
}
void init() { scanf("%d", &n); }
void dfs(int v, int lvl) {
  int bc = -1;
  for (int i = 0; i < SIGMA; ++i) {
    int to = tre[v].nxt[i];
    if (!to) {
      continue;
    }
    dfs(to, lvl + 1);
    if (bc == -1 || tre[to].cnt > tre[bc].cnt) {
      bc = to;
    }
  }
  if (bc != -1) {
    st[v] = st[bc];
    for (int i = 0; i < SIGMA; ++i) {
      int to = tre[v].nxt[i];
      if (!to || to == bc) {
        continue;
      }
      while (!qu[st[to]].empty()) {
        auto len = qu[st[to]].top();
        qu[st[to]].pop();
        qu[st[v]].push(len);
      }
    }
    if (tre[v].finish) {
      qu[st[v]].push(lvl);
    } else if (v != 0) {
      qu[st[v]].pop();
      qu[st[v]].push(lvl);
    }
  } else {
    st[v] = qu.size();
    qu.emplace_back();
    qu.back().push(lvl);
  }
}
long long calc_answer() {
  long long res = 0LL;
  while (!qu[st[0]].empty()) {
    int len = qu[st[0]].top();
    qu[st[0]].pop();
    res += len;
  }
  return ans = res;
}
void solve() {
  for (int i = 0; i < n; ++i) {
    scanf("%s", &s);
    add();
  }
  dfs(0, 0);
  calc_answer();
}
void print_answer() { cout << ans; }
void precalc() {}
void run() {
  precalc();
  int t = 1;
  for (int test_num = 1; test_num <= t; ++test_num) {
    init();
    solve();
    print_answer();
  }
}
int main() {
  srand(90);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  run();
  return 0;
}
