given an array of integers. The task is to count the frequency of each distinct element in the array and return the result in a way that shows how many times each element appears.