思路:
神特么题;
代码:
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007LL
int n,m;
long long ai[],ans;
inline void in(int &now)
{
char Cget=getchar();now=;
while(Cget>''||Cget<'')Cget=getchar();
while(Cget>=''&&Cget<='')
{
now=now*+Cget-'';
Cget=getchar();
}
}
int main()
{
in(n);int pos;
for(int i=;i<=n;i++) in(pos),ai[pos]++;
for(int i=;i<=;i++)
{
for(int v=i;v<=;v++)
{
if(i+v>) break;
if(i==v)
{
if(ai[i]>=&&ai[i<<]>=)
ans=(ans+(ai[i]*(ai[v]-)/%mod)*(ai[i<<]*(ai[i<<]-)/%mod))%mod;
}
else
{
if(ai[i]>=&&ai[v]>=&&ai[i+v]>=)
ans=(ans+((ai[i]*ai[v])%mod)*(ai[i+v]*(ai[i+v]-)/%mod))%mod;
}
}
}
cout<<ans;
return ;
}