QOJ.ac

QOJ

Limite de temps : 2 s Limite de mémoire : 1024 MB Points totaux : 100

#23904. Rare Number

Statistiques

Problem Statement

You are given an integer sequence $A = (A_1, A_2, \dots, A_N)$ of length $N$.

Among the integers that appear in $A$, output the integer whose number of occurrences is the minimum. However, if there are multiple such integers, output the smallest integer among them.

Input

The input is given from Standard Input in the following format:

N
A_1 A_2 ... A_N

Output

Among the integers that appear in $A$, output the integer whose number of occurrences is the minimum. However, if there are multiple such integers, output the smallest integer among them.

Sample

Sample 1

Input
3
3 4 3
Output
4
Explanation

$A$ contains $3$ two ($2$) times and $4$ one ($1$) time. Integers other than $3, 4$ do not appear. Among these, the number of occurrences of $4$ is the minimum, so output $4$.

Sample 2

Input
5
4 4 8 2 5
Output
2
Explanation

$A$ contains $2$ one ($1$) time, $4$ two ($2$) times, $5$ one ($1$) time, and $8$ one ($1$) time. Integers other than $2, 4, 5, 8$ do not appear. Among these, the integers whose number of occurrences is the minimum are $2, 5, 8$. Therefore, output $2$, which is the smallest among $2, 5, 8$.

Sample 3

Input
8
8 8 7 7 6 6 5 5
Output
5

Constraints

  • $1 \le N \le 100$.
  • $1 \le A_i \le 2000$ ($1 \le i \le N$).
  • All input values are integers.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.