#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const int mod = inf + 7;
const double eps = 1e-9;
const double pi = acos(-1.0);
long long read_long() {
  long long ans = 0;
  char c;
  bool started = false;
  bool is_negative = false;
  while (true) {
    c = getchar();
    if ((c < '0' || c > '9') && c != '-' && !started) continue;
    if ((c < '0' || c > '9') && c != '-' && started) break;
    if (started) {
      ans = ans * 10;
    }
    started = true;
    if (c == '-')
      is_negative = true;
    else
      ans += c - '0';
  }
  if (is_negative) ans *= -1;
  return ans;
}
int n;
int to[26][100100];
int sz = 1;
int is_terminal[26 * 100100];
int cnt[26 * 100100];
int deg[26 * 100100];
char tmp[100100];
string second;
void add(string &second) {
  int v = 0;
  for (int i = 0; i < (int)second.size(); i++) {
    int c = second[i] - 'a';
    if (to[c][v] == -1) {
      to[c][v] = sz++;
      deg[sz - 1] = i + 1;
    }
    v = to[c][v];
  }
  is_terminal[v] = 1;
}
set<pair<int, int> > g[100100 * 26];
void solve(int v) {
  if (is_terminal[v]) g[v].insert(make_pair(deg[v], v));
  for (int i = 0; i < 26; i++) {
    if (to[i][v] != -1) {
      solve(to[i][v]);
      for (__typeof(g[to[i][v]].begin()) it = g[to[i][v]].begin();
           it != g[to[i][v]].end(); it++)
        g[v].insert(*it);
    }
  }
  if (v > 0 && !is_terminal[v] && !g[v].empty()) {
    pair<int, int> p = *g[v].rbegin();
    g[v].erase(p);
    p.first = deg[v];
    g[v].insert(p);
  }
}
int main() {
  memset(to, -1, sizeof to);
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", tmp);
    second = tmp;
    add(second);
  }
  solve(0);
  long long ans = 0;
  for (__typeof(g[0].begin()) it = g[0].begin(); it != g[0].end(); it++)
    ans += (it->first);
  cout << ans << endl;
  return 0;
}
