#include <bits/stdc++.h>

using namespace std;
#define ll long long
#define uint unsigned int
#define inf (ll)1e18
#define end1 " "
#define ld long double
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define sf(x) sizeof(x)
#define print_double(d, n) cout<<fixed<<setprecision(n)<<d<<end1;

bool dcmp(int x, int y) {
    return x > y;
}

bool acmp(int x, int y) {
    return x < y;
}

bool afcmp(pair<int, int> a, pair<int, int> b) {
    return a.first < b.first;
}

bool dfcmp(pair<int, int> a, pair<int, int> b) {
    return a.first > b.first;
}

bool ascmp(pair<int, int> a, pair<int, int> b) {
    return a.second < b.second;
}

bool dscmp(pair<int, int> a, pair<int, int> b) {
    return a.second > b.second;
}

int aabs(int a) {
    return a < 0 ? -a : a;
}

int tmax(int a, int b, int c) {
    return max(max(a, b), c);
}

int tmin(int a, int b, int c) {
    return min(min(a, b), c);
}

bool in_range(int x, int l, int r) {
    return x >= l && x <= r;
}

inline char to_char(int c) {
    if (c >= 10) return c - 10 + 'A';
    return c + '0';
}

bool is_prime(int val) {
    if (val == 2) {
        return true;
    }
    if (val % 2 == 0) {
        return false;
    }
    for (int i = 3; i * i <= val; i += 2) {
        if (val % i == 0) {
            return false;
        }
    }
    return true;
}

int gcd(int a, int b) {
    if (a == 0)
        return b;
    if (b == 0)
        return a;
    if (a == b)
        return a;
    if (a > b)
        return gcd(a - b, b);
    return gcd(a, b - a);
}

string tobase(int num, int base) {
    string ret;
    int div = base;
    while (div < num) {
        div *= base;
    }

    for (div /= base;;) {
        ret += to_char(num / div);
        num = num % div;
        if (div < 2) {
            break;
        }
        div /= base;
    }
    return ret;
}


const int maxN = 3005;
bool finished = false;
int N;
ll a[maxN], pre[maxN], mem[maxN][maxN], idx[maxN][maxN], dp[maxN][maxN], mod = (int) 1e9 + 7;


void reset() {
    cin >> N;
    for (int i = 1; i <= N; ++i) {
        cin >> a[i];
        pre[i] = pre[i - 1] + a[i];
    }
}


void solve(void) {
    reset();
    if (finished) {
        return;
    }
    memset(idx, -1, sf(idx));
    memset(mem, -1, sf(mem));
    for (int i = 0; i <= N; ++i) {
        for (int j = 1; j <= N; ++j) {
            idx[i][j] = mem[j][pre[i] % j]+1;
            mem[j][pre[i] % j] = i;
        }
    }

    dp[0][0] = 1;
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= N; ++j) {
            if (idx[i][j] != 0) {
                dp[i][j] = (dp[idx[i][j]-1][j] + dp[idx[i][j]-1][j - 1]) % mod;
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += dp[N][i];
        ans %= mod;
    }
    cout << ans << endl;
}

void open_file() {
    freopen("pump.in", "r", stdin);
    freopen("pump.out", "w", stdout);
}

int main(void) {
    int T = 1;
    // open_file();
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

#include <iostream>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include<string>
#include <cstring>
#include<queue>
#include<set>
#include<stack>
#define MAX_N 100050
#define INF 999999
using namespace std;
typedef long long ll;
ll cnt[300050];
ll a[300050];
ll n;
ll sum;

int  main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		int x = 0;
		cin >> x;
		
		cnt[x+200]++;

	}
	for(int i=-200;i<=200;i++)
		for (int j = -200; j <= 200; j++)
		{
			sum += cnt[i + 200] * cnt[j + 200] * (i - j) * (i - j) ;
		}
	cout << sum / 2;;
}