This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
/*
由于每个数的范围都在10000以内,因此两个数的和在20000以内,所以可以开一个长度是20000的bool数组,
然后枚举所有数对,将所有计算出的两数之和标记一下。
然后再枚举每个数,利用bool数组判断它是否是某两个数的和。
*/
int n;
int a[N];
bool st[20010];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
for (int i = 0; i < n; i++)
for (int j = 0; j < i; j++)
st[a[i] + a[j]] = 1;
int res = 0;
for (int i = 0; i < n; i++) res += st[a[i]];
printf("%d\n", res);
return 0;
}