#include <iostream>
using namespace std;
int gcd(int a, int b) {
return (a == 0) ? b: gcd(b % a, a);
}
int main() {
int n, m = 0;
cin >> n;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
m = gcd(m, a);
}
cout << m;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgZ2NkKGludCBhLCBpbnQgYikgewogICAgcmV0dXJuIChhID09IDApID8gYjogZ2NkKGIgJSBhLCBhKTsKfQoKaW50IG1haW4oKSB7CglpbnQgbiwgbSA9IDA7CgljaW4gPj4gbjsKCWZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CgkJaW50IGE7CgkJY2luID4+IGE7CgkJbSA9IGdjZChtLCBhKTsKCX0KCWNvdXQgPDwgbTsKCXJldHVybiAwOwp9