Last Updated: 17 Sep, 2025

Number Frequency Counter

Easy
Asked in company
Amdocs

Problem statement

You are given a list of N integers. Your task is to count the frequency of each unique number in the list.

You must then print the unique numbers and their corresponding frequencies, sorted in ascending order by the number.


Input Format:
The first line of input contains an integer 'N', the number of elements in the list.
The second line contains 'N' space-separated integers, representing the list of numbers.


Output Format:
For each unique number found in the list, print a new line in the format: number->frequency
The lines must be sorted in ascending order based on the number.


Note:
The numbers can be positive, negative, or zero.