23 lines
340 B
C++
23 lines
340 B
C++
|
#include<iostream>
|
||
|
using namespace std;
|
||
|
bool ce[20001]={0};
|
||
|
int main(){
|
||
|
int n;
|
||
|
int a[101],ans=0;
|
||
|
cin>>n;
|
||
|
for(int i=1;i<=n;i++){
|
||
|
cin>>a[i];
|
||
|
ce[a[i]]=1;
|
||
|
}
|
||
|
for(int i=1;i<=n-1;i++){
|
||
|
for(int j=i+1;j<=n;j++){
|
||
|
int now=a[i]+a[j];
|
||
|
if(ce[now]==1){
|
||
|
ans++;
|
||
|
ce[now]=0;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
cout<<ans;
|
||
|
return 0;
|
||
|
}
|