N = gets

s_sort = []

for i in 0..N.to_i-1
    s = gets.chomp
    s_sort.push(s.chars.sort.join)
end

print s_sort.group_by(&:itself).map{ |key,value| [key,value.count] }.to_h.max{ |x, y| x[1] <=> y[1] }[1]-1
