## Algorithm

Problem Name: 2 AD-HOC - beecrowd | 1171

# Number Frequence

Adapted by Neilor Tonin, URI Brazil

Timelimit: 1

In this problem your job is to read some positive and integer numbers and print how many times each number appears in the input, you must write each of the distinct values ​​that appear in the input, ordering by ascending value.

## Input

The input contains only one test case. The first line of input contains one integer N, which indicates the quantity of numbers ​​that will be read to X (1 ≤ X ≤ 2000) in the sequence. Each number don't appears more than 20 times in the problem input.

## Output

Print the output according to the example provided below, indicating how many times each number appears in the input file, by ascending order of value.

 Input Sample Output Sample 7 8 10 8 260 4 10 10 4 aparece 1 vez(es) 8 aparece 2 vez(es) 10 aparece 3 vez(es) 260 aparece 1 vez(es)

## Code Examples

### #1 Code Example with C Programming

```Code - C Programming```

``````
#include <stdio.h>

int main(void) {
int q, i, n;
int lista[2000];

for (i = 0; i  <  2000; ++i)
lista[i] = 0;

scanf("%d", &q);
for (i = 0; i  <  q; ++i) {
scanf("%d", &n);
++lista[n-1];
}

for (i = 0; i  <  2000; ++i)
if (lista[i] != 0)
printf("%d aparece %d vez(es)\n", i+1, lista[i]);
return 0;
}

``````
Copy The Code &

Input

cmd
7
8
10
8
260
4
10
10

Output

cmd
4 aparece 1 vez(es)
8 aparece 2 vez(es)
10 aparece 3 vez(es)
260 aparece 1 vez(es)

### #2 Code Example with C++ Programming

```Code - C++ Programming```

``````
#include <iostream>

using namespace std;

int main(void) {
int q, i, n;
int lista[2000];

for (i = 0; i  <  2000; ++i)
lista[i] = 0;

cin >> q;
for (i = 0; i  <  q; ++i) {
cin >> n;
++lista[n-1];
}

for (i = 0; i  <  2000; ++i)
if (lista[i] != 0)
cout << i+1 << " aparece " << lista[i] << " vez(es)" << endl;
return 0;
}
``````
Copy The Code &

Input

cmd
7
8
10
8
260
4
10
10

Output

cmd
4 aparece 1 vez(es)
8 aparece 2 vez(es)
10 aparece 3 vez(es)
260 aparece 1 vez(es)

### #3 Code Example with Java Programming

```Code - Java Programming```

``````
import java.io.IOException;
import java.util.Scanner;
public class Main {

public static void main(String[] args) throws IOException {

Scanner sc = new Scanner(System.in);
while (sc.hasNextInt()) {
int n = 0, num = 0, cont = 0, aux = 0, cont2 = 0;
n = sc.nextInt();
int[] vet = new int[n];
for (int i = 0; i  <  n; i++) {
vet[i] = sc.nextInt();
}
for (int i = 0; i  <  vet.length; i++) {
for (int j = 0; j  <  vet.length - 1; j++) {
if (vet[j] > vet[j + 1]) {
aux = vet[j];
vet[j] = vet[j + 1];
vet[j + 1] = aux;
}
}
}
for (int i = 0; i  <  vet.length; i++) {
cont = 0;
num = vet[i];
for (int j = 0; j  <  vet.length; j++) {
if (vet[i] == vet[j] && vet[i] != 0 && vet[j] != 0 && vet[j] != cont2) {
cont++;
}
}
cont2 = vet[i];
if (cont != 0 && vet[i] != 0) {
System.out.println(num + " aparece " + cont + " vez(es)");
}
}
}

}

}
``````
Copy The Code &

Input

cmd
7
8
10
8
260
4
10
10

Output

cmd
4 aparece 1 vez(es)
8 aparece 2 vez(es)
10 aparece 3 vez(es)
260 aparece 1 vez(es)

### #4 Code Example with Python Programming

```Code - Python Programming```

``````
n = int(input())
v = []
for i in range(n):
v.append(int(input()))
v.sort()
for i, j in enumerate(v):
if i == 0:
print('{} aparece {} vez(es)'.format(j, v.count(j)))
elif j != u: print('{} aparece {} vez(es)'.format(j, v.count(j)))
u = j
``````
Copy The Code &

Input

cmd
7
8
10
8
260
4
10
10

Output

cmd
4 aparece 1 vez(es)
8 aparece 2 vez(es)
10 aparece 3 vez(es)
260 aparece 1 vez(es)