#K721. First Non-Repeating Integer

    ID: 33678 Type: Default 1000ms 256MiB

First Non-Repeating Integer

First Non-Repeating Integer

Given an array of integers, your task is to find the first element that appears exactly once in the list. In other words, if we define \(f(x)\) as the frequency of an element \(x\) in the array, you must output the first \(x\) for which \(f(x)=1\). If no such element exists, then print None.

Example: For the input array [4, 5, 1, 2, 2, 1, 3, 4], the output should be 5, because 5 is the first element that does not repeat.

inputFormat

The input is provided via standard input (stdin) and consists of two lines:

  • The first line contains a single integer \(n\) (\(1 \le n \le 10^5\)), which denotes the number of elements in the array.
  • The second line contains \(n\) space-separated integers.

outputFormat

Output a single line via standard output (stdout) containing the first non-repeating integer. If there is no such integer, output None.

## sample
8
4 5 1 2 2 1 3 4
5