#CCBCHBAHAI0000083. Giá trị xuất hiện đúng một lần - nhỏ nhất (Smallest Value Appearing Exactly Once)
Giá trị xuất hiện đúng một lần - nhỏ nhất (Smallest Value Appearing Exactly Once)
Smallest Value Appearing Exactly Once
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given with , define
and . Print if is nonempty; otherwise print -1.
Input
The first line contains . The second line contains integers in .
Output
Print the smallest value appearing exactly once, or -1 if none exists.
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , .
Example
Input
8
5 2 9 2 7 5 4 9
Output
4
Explanation
The output follows directly from the mathematical definition above.