eolymp
bolt
Try our new interface for solving problems
Problems

Softville

Softville

It’s common practice in the village of Softville to produce software in a specific way: in the first day the programmer writes several lines of code (at least one line) and every next day he or she writes one line more than the day before. After they turn \textbf{10} years old, every citizen of Softville should be initiated by writing from scratch a very complicated program. The code of the program is the same for all citizens and contains exactly \textbf{N} lines. It takes a different number of days for each citizen to complete the task. Nevertheless the rule always remains true: every day each programmer writes one line more than he wrote the previous day. You’ll be given data about how many days it took citizens of Softville to write their initial program. You should determine the least possible value for \textbf{N} i.e. the number of lines of the program. \InputFile The first line of the input file contains the number \textbf{m} (\textbf{1} ≤ \textbf{m} ≤ \textbf{1000}) of citizens of Softville. The second line contains \textbf{m} numbers which represent the number of days each citizen was occupied writing the initial program. All numbers in the second line are positive integers less than \textbf{2^63}. \OutputFile The only number in the output should be the least possible value for \textbf{N}. In case input data wouldn’t be consistent regardless of value of \textbf{N} you should output \textbf{0}, otherwise it’s guaranteed that the least possible value for \textbf{N} is less than \textbf{2^63}.
Time limit 0.2 seconds
Memory limit 256 MiB
Input example #1
2
2 3
Output example #1
9
Source ACM ICPC SEERC-2012, 13.10.2012 Bucharest, Vinnica