#C3945. First Odd Occurrence

    ID: 47428 Type: Default 1000ms 256MiB

First Odd Occurrence

First Odd Occurrence

You are given a list of integers. Your task is to find the first integer in the list that appears an odd number of times. If no such integer exists, print None instead.

More formally, let the list be \(A = [a_1, a_2, \dots, a_n]\). For each integer \(x\) in the list, let \(f(x)\) denote the number of times \(x\) appears in \(A\). You must output the first \(a_i\) (in the order of the list) such that \(f(a_i)\) is odd (i.e., \(f(a_i) \bmod 2 = 1\)). If there is no such element, print None.

inputFormat

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

  • The first line contains a single integer n, the number of elements in the list.
  • The second line contains n space-separated integers.

If n is zero, there will be no second line.

outputFormat

Print the first integer that appears an odd number of times. If no such integer exists, print None.

The output should be written to stdout.

## sample
7
4 5 4 5 5 4 4
5