#C3434. Smallest Duplicated ID Finder

    ID: 46861 Type: Default 1000ms 256MiB

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

Output: 2

</p>

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\).

## sample
5
1 2 3 2 4
2