#include <cstdio>
#define int long long
const int N = 3005, P = 1000000007;
int n, a[N], ans, f[N], tub[N], b[N], t[N];
signed main() {
    scanf("%lld", &n);
    for(int i = 1; i <= n; i++) scanf("%lld", &a[i]), a[i] += a[i-1];
    for(int i = 1; i <= n; i++) f[i] = 1; 
    ans = (ans + f[n]) % P;
    for(int i = 2; i <= n; i++) {
        for(int j = 1; j <= n; j++) b[j] = a[j] % i;
        for(int j = 0; j <= n; j++) tub[j] = 0; 
        for(int j = 1; j <= n; j++) t[j] = f[j];
        for(int j = 1; j <= n; j++) {
            f[j] = tub[b[j]] % P;
            tub[b[j]] = (tub[b[j]] + t[j]) % P;
        }
        ans = (ans + f[n]) % P;
    }
    printf("%lld", ans);
    return 0;
}
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;
ll gcd(ll x, ll y) {
    if (x % y == 0) {
        return y;
    } else {
        return gcd(y, x % y);
        // x%y==0でないときはユーグリットの互除法を使って再帰的に関数を呼び出す。
    }
}

int main() {
    ll n, ans, max_cnt = 0;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    // rep(i, 1001) {
    //     int cnt = 0;
    //     for (int j = i + 1; j < n; j++) {
    //         if (gcd(a[i], a[j]) == a[i]) cnt++;
    //     }
    //     if (cnt > max_cnt) {
    //         max_cnt = cnt;
    //         ans = a[i];
    //         debug(max_cnt, ans);
    //     }
    // }
    for (int i = 2; i < 1001; i++) {
        int cnt = 0;
        for (int j = 0; j < n; j++) {
            // if (gcd(i, a[j]) == i) cnt++;
            if (a[j] % i == 0) cnt++;
        }
        if (cnt > max_cnt) {
            max_cnt = cnt;
            ans = i;
            debug(max_cnt, ans);
        }
    }
    cout << ans << endl;
    return 0;
}