N = gets.to_i S=*$<.sort.reverse puts S.max_by{|s|S.count s}.size-3