Count how many times each beat value is collected and compute the total number of distinct beat values.
Problem
You are collecting beats over time. Each beat is represented by an integer value. Your task is to process the sequence and determine how many times each value appears, or any other simple aggregate requested by the exact problem variant.
For this record, the intended core task is a straightforward implementation-style counting problem: read the input sequence and compute the required summary directly without advanced data structures.
Input Format
- The first line contains an integer .
- The second line contains integers describing the collected beats.
Output Format
- Output the required summary for the given sequence.
Constraints
- Values fit in 32-bit signed integers
Hints
- This is typically solved with a single pass over the array.
- Keep track of counts or running totals as needed.
Input Format
The first line contains an integer . The second line contains integers.
Output Format
Output the required summary for the sequence.
Constraints
Use a linear scan and simple counting/aggregation. Values fit in 32-bit signed integers.
Example 1
Input
5 1 2 1 3 2
Output
3
Explanation
There are 3 distinct values in the sequence: 1, 2, and 3.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.