Pergunta de entrevista da empresa Amdocs

How will you count occurrences of every element in an array?