#define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #include using namespace std; int main() { int n; cin >> n; vector v1(n), v2; v2.reserve(n * (n - 1) / 2); for (auto &x : v1) cin >> x; for (int i = 0; i < n; i++) for (int j = 0; j < i; j++) v2.push_back(v1[i] + v1[j]); sort(v2.begin(), v2.end()); cout << count_if(v1.begin(), v1.end(), bind(binary_search, v2.begin(), v2.end(), placeholders::_1)); return 0; }