import java.util.*;
public class Main
{
public static long gcd(long m, long n)
{
if (n != 0)
return gcd(n, m%n);
else
return m;
}
{
Scanner in
= new Scanner
(System.
in); long m = in.nextLong(), n, result = in.nextLong();
for(long i = 2; i <= m; ++i)
{
n = in.nextLong();
result = gcd(result, n);
if (result == 1) m = 1; //same as break
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwoKcHVibGljIGNsYXNzIE1haW4KewoJcHVibGljIHN0YXRpYyBsb25nIGdjZChsb25nIG0sIGxvbmcgbikKCXsKCQlpZiAobiAhPSAwKQoJCQlyZXR1cm4gZ2NkKG4sIG0lbik7CgkJZWxzZQoJCQlyZXR1cm4gbTsKCX0KCglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlsb25nIG0gPSBpbi5uZXh0TG9uZygpLCBuLCByZXN1bHQgPSBpbi5uZXh0TG9uZygpOwoJCQoJCWZvcihsb25nIGkgPSAyOyBpIDw9IG07ICsraSkKCQl7CgkJCW4gPSBpbi5uZXh0TG9uZygpOwoJCQlyZXN1bHQgPSBnY2QocmVzdWx0LCBuKTsKCQkJaWYgKHJlc3VsdCA9PSAxKSBtID0gMTsgLy9zYW1lIGFzIGJyZWFrCgkJfQoJCVN5c3RlbS5vdXQucHJpbnRsbihyZXN1bHQpOwoJfQp9