#!/bin/ruby n = gets.strip.to_i types = gets.strip types = types.split(' ').map(&:to_i) # your code goes here def birds(n, arr) max = 0 freq = [0, 0, 0, 0, 0, 0] n.times { |i| freq[arr[i]] += 1 } freq.each.with_index { |e, ind| max = [e, ind] if e > max[0] } max[1] end puts birds(n, types)