#C678. First Unique Element

    ID: 50577 Type: Default 1000ms 256MiB

First Unique Element

First Unique Element

This problem requires you to find the first unique element in an array of integers. An element is called unique if it appears exactly once in the array. Formally, given an array A of n integers, an element a is unique if its frequency satisfies the equation $$f(a)=1$$, where $$f(a)$$ denotes the number of times a appears in A. Your task is to output the first element (from left to right) for which this holds. If there is no such element, output -1.

inputFormat

The input is read from stdin and has the following format:

  1. The first line contains an integer n, the number of elements in the array.
  2. The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single integer to stdout which is the first unique element in the array. If there is no unique element, output -1.

## sample
5
4 5 1 2 2
4