#include "bits/stdc++.h"
using namespace std;
typedef long long li;



int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    li n;
    cin >> n;
    vector<li> xs(n);
    for (int i = 0; i < n; ++i) {
        cin >> xs[i];
    }
    li ans = xs[0];
    for (int i = 0; i < n; ++i) {
        ans = __gcd(ans, xs[i]);
    }
    cout << ans << endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
using u64 = uint_least64_t;
using s64 = int_least64_t;
using ll = uint_least64_t;

int main(){
    u64 n;
    cin >> n;
    vector<u64> a(n);
    for (u64 i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    // a.erase(unique(a.begin(), a.end()), a.end());

    u64 sum;
    for (u64 i = 0; i < a.size(); i++){
        if (i == 0){
            sum = a[i]%1000000007 +1;
        }else{
            sum *= a[i]%1000000007 - a[i - 1]%1000000007+1;
            sum = sum % 1000000007;
        }
    }
    cout << sum << endl;
	return 0;
}
