```
class Solution {
public:
int fourSumCount(vector<int>& A, vector<int>& B, vector<int>& C, vector<int>& D) {
int count = 0;
unordered_map<int, int> mp;
int n = A.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
mp[A[i] + B[j]]++;
}
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
count += mp[0-C[i]-D[j]];
}
}
return count;
}
};
```