Skip to main content
Back to problems
Codeforces
Easy
Arrays
Math
Simulation
Collecting Beats is Fun

Count how many times each beat value is collected and compute the total number of distinct beat values.

Acceptance 0%
Also Available On
Other platform versions and source mappings for the same problem.
Problem Statement

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 nn.
  • The second line contains nn integers describing the collected beats.

Output Format

  • Output the required summary for the given sequence.

Constraints

  • 1n2×1051 \le n \le 2 \times 10^5
  • 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 nn. The second line contains nn 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.

Examples
Sample cases returned by the problem API.

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.

Guided hints
Editorial and discussion links
Concept map and variants
Sign in to unlock
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.