How to Perform a Counting Using Array and Hash Table