import java.io.BufferedInputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new HDU1800().solve() ;
}
}
class HDU1800{
Trie root ;
int res ;
Scanner in = new Scanner(new BufferedInputStream(System.in)) ;
PrintWriter out = new PrintWriter(System.out) ;
void solve(){
while(in.hasNext()){
int n = in.nextInt() ;
root = new Trie() ;
res = 0 ;
while(n-- > 0){
add(in.next() ) ;
}
out.println(res) ;
// out.flush() ;
}
out.flush() ;
}
void add(String s){
Trie now = root ;
int i = 0 ;
while(i < s.length() && s.charAt(i) == '0') i++ ;
while(i < s.length()){
int d = s.charAt(i) - '0' ;
if(now.next[d] == null)
now.next[d] = new Trie() ;
now = now.next[d] ;
i++ ;
}
res = Math.max(res , ++now.cnt) ;
}
}
class Trie{
int cnt ;
Trie[] next = new Trie[10] ;
Trie(){
cnt = 0 ;
}
}