#C3434. Smallest Duplicated ID Finder
Smallest Duplicated ID Finder
Smallest Duplicated ID Finder
You are given a list of IDs. Your task is to find the smallest ID that appears more than once. Specifically, you will be provided an integer \( n \) representing the number of IDs, followed by a line containing \( n \) space-separated integers. If there is no duplicated ID, output \(-1\).
Example:
Input: 5 1 2 3 2 4</p>Output: 2
In this example, the number \(2\) is the only duplicated ID and thus is the smallest duplicate.
inputFormat
The input is read from standard input (stdin). The first line contains an integer \( n \) representing the number of IDs. The second line contains \( n \) space-separated integers.
outputFormat
Output to standard output (stdout) a single integer which is the smallest duplicated ID. If there is no duplicate, output \(-1\).
## sample5
1 2 3 2 4
2