#include <iostream> #include <unordered_map> using namespace std; int main() { int n, xorPairs = 0; cin >> n; unordered_map<int, int> xorMap; for(int i = 0; i < n; ++i) { int num; cin >> num; xorPairs += xorMap[num]; xorMap[num]++; } cout << xorPairs; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter