# include <iostream>
# include <stdio.h>
# include <string.h>
# include <algorithm>
# include <math.h>
# include <queue>
# include <string>
# include <vector>
# include <set>
# include <map>
#include<string>
# define INF 0x3f3f3f3f
# define clr0(x) memset(x,0,sizeof(x))
# define clr1(x) memset(x,INF,sizeof(x))
# define clrf(x) memset(x,-1,sizeof(x))
# define rep(i,a) for(int i = 0;i<(a);i++)
# define repf(i,a,b) for(int i = (a);i<=(b);i++)
# define repu(i,a,b) for(int i = (a);i<(b);i++)
# define repd(i,a,b) for(int i = (a);i>=(b);i--)
# define lowbit x&(-x)
# define W(a) while(a)
# define Sc(x) scanf("%d",&(x))
# define Sd(x) scanf("%I64d",&(x))
# define Lson(x) (x)<<1
# define Rson(x) (x)<<1|1
# define ll long long
# define fuckio ios::sync_with_stdio(false);
# define fuck cout<<"fucl:"<<__LINE__<<endl;
# define gcd(a,b) __gcd((a),(b))
# define maxn 100020
using namespace std;
const int ALTN = 30;
int a[maxn];
int nexta[maxn];
void getnxt(string s)
{
int n = (int)s.length();
int i = -1;int j = 0;
clr0(nexta);
nexta[0] = -1;
W(j<n){
if(i == -1||s[i] == s[j]){
nexta[j+1] = i+1;
i++;j++;
}else{
i = nexta[i];
}
}
}
int kmp(string s,string t)
{
int n = (int)s.length();
int m = (int)s.length();
int res = -1;
int i = 0,j = 0;
W(i<n&&j<m){
if(j == -1||s[i] == t[j]){
i++;j++;
}else {
j = nexta[j];
}
}
if(j == m)res = i-m;
return res;
}
struct Node
{
Node *nxt[ALTN];
int flag;
Node(){
rep(i,ALTN)nxt[i] = NULL;
flag = 0;
}
};
Node *root;
void init()
{
root = new Node();
}
void ins(string s)
{
int len = (int)s.length();
Node *now = root;
rep(i,len){
int to = s[i]-'a';
if(now->nxt[to] == NULL)now->nxt[to] = new Node();
now = now->nxt[to];
}
now->flag++;
}
int fid(string s)
{
int len = (int)s.length();
Node *now = root;
rep(i,len){
int to = s[i]-'a';
if(now->nxt[to] == NULL)return 0;
now = now->nxt[to];
}
return now->flag;
}
int main()
{
int n;
scanf("%d",&n);
string s[50005];
for(int i=0;i<n;i++)
{
cin>>s[i];
}
init();
for(int i=0;i<n;i++)
{
ins(s[i]);
}
int ans=0;
for(int i=0;i<n;i++)
{
reverse(s[i].begin(), s[i].end());
if(fid(s[i])==1)
{
ans++;
}
}
cout<<ans/2<<endl;
return 0;
}