use std::io::Read; fn gcd(a: i64, b: i64) -> i64 { if b == 0 { a } else { gcd(b, a % b) } } fn run() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.trim().split_whitespace(); let n: usize = it.next().unwrap().parse().unwrap(); let mut ans = 0; for s in it { let a: i64 = s.parse().unwrap(); if a > 0 { ans = gcd(ans, a * a); } } if ans == 0 { println!("-1"); } else { println!("{}", ans); } } fn main() { run(); }