ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1053. Pinocchio

Time limit: 1.0 second
Memory limit: 64 MB
Mister Geppetto got the commission to make Pinocchio. Client expressed a wish to be unknown and he left material and insisted on finding Pinocchio's nose length as a result of performing the following algorithm:
  1. There's a set of N numbered blanks with integer lengths.
  2. If the set consists of only one blank, then it's length can be admitted as the length of Pinocchio's nose.
  3. Let's choose some 2 blanks
    1. If lengths of the blanks coincide, then one of the blanks is eliminated from the set and algorithm goes back to point 2 to be repeated.
    2. If lengths of the blanks are different, then the piece of the long blank is sawed off and its length must be equal to the length of the other blank. Then the algorithm is repeated from point 2.
Example. There are three blanks in a set with lengths: 2, 3, 4. Then the change of the blank lengths can be shown in the following table. As a result Pinocchio will get the nose with length of 1.
Length of the first blank Length of the second blank Length of the third blank Comments
2 3 4 Initial blank lengths
2 1 4 Sawing off the second blank
2 1 3 Sawing off the third blank
2 1 2 Sawing off the third blank
1 1 2 Sawing off the first blank
- 1 2 The first blank is eliminated
- 1 1 Sawing off the third blank
- - 1 The second blank is eliminated

Input

The first line contains an integer N (1 ≤ N ≤ 1000). The other N successive lines contain integers L1, L2, …, LN that are initial blank lengths (1 ≤ Li ≤ 231 − 1).

Output

Output either Pinocchio nose length, or the word “IMPOSSIBLE” if the nose length is undefined.

Sample

inputoutput
3
2
3
4
1
Problem Source: Rybinsk State Avia Academy