use std::collections::HashMap;

fn main() {
    let mut xx = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut xx).ok();
    let xx: Vec<&str> = xx.split_whitespace().skip(1).collect();

    let mut count = HashMap::new();
    for &x in &xx {
        *count.entry(x.len() - 2).or_insert(0) += 1;
    }

    let max = *count.values().max().unwrap();
    let answer = count
        .iter()
        .filter(|(_, &n)| n == max)
        .map(|(&l, _)| l)
        .max()
        .unwrap();

    println!("{answer}");
}