#C1775. Count Occurrences in an Array

    ID: 45017 Type: Default 1000ms 256MiB

Count Occurrences in an Array

Count Occurrences in an Array

You are given an array of integers. Your task is to count the number of occurrences of each unique integer and output each unique integer and its count.

The output should list the unique integers in ascending order. For each unique integer \(x\), you need to output a line in the format:

\[ x \; count\(x)\ \]

where count(x) is the number of times \(x\) appears in the input array.

Note: If the array is empty, produce no output.

inputFormat

The input is provided via standard input (stdin). The first line contains an integer \(n\) representing the number of elements in the array. If \(n > 0\), the second line contains \(n\) space-separated integers.

outputFormat

Output each unique integer along with its occurrence count in ascending order of the integer. Each line should contain two space-separated integers.

## sample
8
4 6 4 3 4 3 3 1
1 1

3 3 4 3 6 1

</p>