#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<set>
#include<stack>
#include<map>
#define maxn 1000000
using namespace std;
int n,ans=0,idex=0,cnt[1000000];
string s[maxn];
char tree[maxn][27];
void insert(string s) {
int p = 0,maxs=0;
for (int i = 0; s[i]; ++i) {
int j = s[i] - 'a';
if (!tree[p][j]) {
tree[p][j] = ++idex;
}
p = tree[p][j];
maxs += cnt[p];
}
cnt[p]++;
ans = max(maxs+1, ans);
}
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s[i];
insert(s[i]);
}
cout << ans;
return 0;
}
inline int read() {
int w = 1, q = 0;
char ch = ' ';
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') w = -1, ch = getchar();
while (ch >= '0' && ch <= '9') q = q * 10 + ch - '0', ch = getchar();
return w * q;
}