#include<iostream>#define ll long longusingnamespacestd;constintMAXA=5E3;constintMOD=1E9+7;intcnt[MAXA];llcn2(lln){returnn*(n-1)/2;}intmain(){intn;cin>>n;intmaxa=0;for(inti=1,a;i<=n;i++){cin>>a;maxa=max(maxa,a);cnt[a]++;}llans=0;for(inti=2;i<=maxa;i++){if(cnt[i]>=2){for(intj=1;j<<1<=i;j++){if(j==i-j&&cnt[j]>=2){ans=(ans+((cn2(cnt[j])%MOD)*(cn2(cnt[i])%MOD))%MOD)%MOD;}elseif(j!=i-j&&cnt[j]&&cnt[i-j]){ans=(ans+(((cnt[j]*cnt[i-j])%MOD)*(cn2(cnt[i])%MOD))%MOD)%MOD;}}}}cout<<ans<<endl;return0;}