Ruby code that gets count of duplicate value from an array