#include <cstdio>
#define N 100005
#define mod 1000000007
using namespace std;
int n;
int a[N];
int tot[N];
int ans;
int main() {
scanf("%d", &n);
for(int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
++tot[a[i]];
}
for(int i = 5000; i > 0; --i) {
if(tot[i] < 2)
continue;
for(int j = 5000; j > 0; --j) {
if(!tot[j])
continue;
if(i - j < 1)
continue;
if(!tot[i - j])
continue;
++ans;
}
}
printf("%d\n", ans % mod);
return 0;
}