Find Occurrence

0

0 votes
Problem

As we all know that Varchas is going on. So FOC wants to organise an event called Finding Occurrence.

The task is simple :

Given an array A[1...N] of positive integers. There will be Q queries. In the queries you will be given an integer. You need to find out the frequency of that integer in the given array.

INPUT:

First line of input comprises of integer N, the number of integers in given array.

The next line will comprise of N space separated integers. The next line will be Q, number of Queries.

The next Q lines will comprise of a single integer whose Occurrence you are supposed to find out.

OUTPUT:

Output single integer for each Query which is the frequency of the given integer.

Constraints:

  • 1<=N<=100000
  • 1<=Q<=100000
  • 0<=A[i]<=1000000

Example:

Sample Input:

4

2 2 4 9

2

2

4

Sample Output:

2

1

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?