#include<cstdio>
#include<cctype>
#include<queue>
#include<cstring>
#include<algorithm>
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define dwn(i,s,t) for(int i=s;i>=t;i--)
#define ren for(int i=first[x];i;i=next[i])
using namespace std;
const int maxn=100010;
const int maxnode=600010;
typedef long long ll;
int ch[maxnode][26],val[maxnode],ToT;
void insert(char* s) {
int j=0,n=strlen(s),c;
dwn(i,n-1,0) {
c=s[i]-‘a‘;
if(!ch[j][c]) ch[j][c]=++ToT;
j=ch[j][c];
}
val[j]=1;
}
int first[maxn],next[maxn],to[maxn],ct=1,e;
void AddEdge(int u,int v) {to[++e]=v;next[e]=first[u];first[u]=e;}
void build(int x,int fa) {
if(val[x]) AddEdge(fa,++ct),fa=ct;
rep(c,0,25) if(ch[x][c]) build(ch[x][c],fa);
}
int cur,A[maxn],son[maxn],s[maxn];
int cmp(int x,int y) {return s[x]<s[y];}
void getsize(int x) {
s[x]=1;int cnt=0;
ren getsize(to[i]),s[x]+=s[to[i]];
ren son[++cnt]=to[i];
sort(son+1,son+cnt+1,cmp);cnt=0;
ren to[i]=son[++cnt];
}
ll dfs(int x,int fa) {
A[x]=++cur;ll res=A[x]-A[fa];
ren res+=dfs(to[i],x);
return res;
}
char str[maxn];
int main() {
int n;scanf("%d",&n);
rep(i,1,n) scanf("%s",str),insert(str);
build(0,1);getsize(1);
printf("%lld\n",dfs(1,1));
return 0;
}