#K92212. Count Mountain Climbs
Count Mountain Climbs
Count Mountain Climbs
Mark loves climbing mountains. Given a sequence of mountain heights he climbed and several queries for specific heights, determine how many times he climbed a mountain with each queried height. Mathematically, for a query height (h), the answer is computed as $$\text{count}(h) = \sum_{i=1}^{n} \mathbb{1}(h_i = h)$$, where (\mathbb{1}(\text{condition})) equals 1 if the condition holds and 0 otherwise.
inputFormat
The input consists of four lines:
- The first line contains an integer (n), the number of mountains climbed.
- The second line contains (n) space-separated integers representing the heights of the mountains.
- The third line contains an integer (q), the number of queries.
- The fourth line contains (q) space-separated integers representing the query heights.
outputFormat
Output (q) integers separated by spaces. Each integer is the number of times the corresponding query height appears in the list of mountain heights.## sample
6
1200 1300 1200 1250 1300 1200
1
1200
3
</p>