#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;
const int BASE = 26;
int n;
char ts[MAXN];
int ch[MAXN][BASE], kc, len[MAXN];
bool hv[MAXN];
void init();
void input();
void work();
void addtrie(char s[]) {
  int nl = strlen(s), now = 0, nc;
  for (int i = 0; i < nl; ++i) {
    nc = s[i] - 'a';
    if (!ch[now][nc]) ch[now][nc] = ++kc, len[kc] = len[now] + 1;
    now = ch[now][nc];
  }
  hv[now] = true;
}
void dfs(int now, vector<int>& ans);
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%s", ts);
    addtrie(ts);
  }
}
void work() {
  vector<int> ans;
  dfs(0, ans);
  int sum = 0;
  for (auto x : ans) sum += x;
  cout << sum << endl;
}
void dfs(int now, vector<int>& ans) {
  ans.clear();
  vector<int> va;
  for (int i = 0; i < BASE; ++i) {
    if (ch[now][i]) {
      dfs(ch[now][i], va);
      for (auto x : va) ans.push_back(x);
    }
  }
  if (hv[now])
    ans.push_back(len[now]);
  else if (len[now])
    *max_element(ans.begin(), ans.end()) = len[now];
}
