#K62762. Smallest Unique Number

    ID: 31604 Type: Default 1000ms 256MiB

Smallest Unique Number

Smallest Unique Number

Given a list of integers, your task is to find the smallest integer that appears exactly once in the list. In other words, if an integer occurs only once in the list, consider it as unique. Your program should output the smallest of these unique numbers. If no unique number exists, output -1.

More formally, assume the list of $$ nums = [a_1, a_2, \dots, a_n] $$ We define a number \(a_i\) as unique if it appears exactly once in \(nums\). The answer is the minimum among all unique numbers, or \(-1\) if there are none.

inputFormat

The first line contains an integer n representing the number of integers in the list.

The second line contains n space-separated integers.

outputFormat

Output a single integer, which is the smallest unique number in the list. If there is no unique number, output -1.

## sample
7
4 2 3 2 4 3 1
1