Sorting value frequency within an array

How is it possible to sort different nummeric values within an Array. But i don`t want the highest or the lowest. I need the most frequently occurring value.
For examble:
My Array has to following values = (200 404 404 500 404 404 404 200 404)
The result should be 404
The values are HTTP-Errorcodes, so their could be values of 1xx to 5xx

This should be solved in shell script. I tried different things by using programs like sort, uniq, awk, cut, .. but did not found a solution.

Thank you in advance

Best regards
2retti

rough hack to get you in the right direction...

#  echo 200 404 404 500 404 404 404 200 404 | tr " " "\n" | sort | uniq -c | sort -nr | sed '{s/.* //;q;}'
404

HTH

If "file" contains the values..

gawk 'A[$0]++ && (A[$0] > max) { max=A[$0]; _=$0} END { print _; }' file

thank you very much for helping me! Its functions perfectly...