#include<bits/stdc++.h>
using namespace std;
using namespace std;
int n,a[100005],dp[100005][2],cnt[100005][2];
const int mod=1e9+7;
int M(int x){return x>=mod?x-mod:x;}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	dp[1][0]=a[1];cnt[1][0]=1;
	for(int i=2;i<=n;i++)
	{
		cnt[i][0]=M(cnt[i-1][0]+cnt[i-1][1]);
		dp[i][0]=1ll*(1ll*M(dp[i-1][0]+dp[i-1][1])+1ll*a[i]*cnt[i][0])%mod;
		cnt[i][1]=cnt[i-1][0];
		dp[i][1]=1ll*(1ll*dp[i-1][0]+1ll*(mod-a[i])*cnt[i][1])%mod;
	}
	printf("%d\n",M(dp[n][0]+dp[n][1]));
	return 0;
}
#include <bits/stdc++.h>


#define int long long


#define f first
#define s second
#define rep(i,a,b)for(int i=a;i<b;i++)
#define pb push_back

const int mod = 1e9 + 7;
const int INF = 1e18;
const int SIZE = 1e5 + 5;
using namespace std;




void solve() {


    int n;
    cin >> n;

    int a[n];
    rep(i, 0, n) {cin >> a[i]; a[i] %= 200;}

    int ans = 0;


    map<int, int> mp;

    rep(i, 0, n) {
        mp[a[i]]++;
    }

    for (auto it : mp) {
        int k = it.second;

        ans += (k * (k - 1)) / 2;
    }

    cout << ans << "\n";

}

signed main()
{
    ios::sync_with_stdio(0);

    cin.tie(0);
    cout.tie(0);


    int T = 1;

    // cin >> T;
    // sieve();

    // op();

    while (T--)
    {

        solve();


    }

    return 0;
}