#include <iostream>
#include <vector>
using namespace std;

// Function to count the number of set bits in an integer
int countSetBits(int n) {
    int count = 0;
    while (n) {
        count += n & 1;
        n >>= 1;
    }
    return count;
}

// Function to count even and odd set bits in an array
void countEvenOddSetBits(const vector<int>& arr, int& evenCount, int& oddCount) {
    evenCount = oddCount = 0;
    for (int num : arr) {
        if (countSetBits(num) % 2 == 0) {
            evenCount++;
        } else {
            oddCount++;
        }
    }
}

int main() {
    vector<int> A = {1, 2, 3};  // Example input
    vector<int> B = {4, 5, 6};
    vector<int> C = {7, 8, 9};

    int E1, O1, E2, O2, E3, O3;

    countEvenOddSetBits(A, E1, O1);
    countEvenOddSetBits(B, E2, O2);
    countEvenOddSetBits(C, E3, O3);

    long long result = (long long)E1 * E2 * E3 + (long long)E1 * O2 * O3 + (long long)O1 * E2 * O3 + (long long)O1 * O2 * E3;

    cout << "The number of triplets with an even number of set bits in their XOR is: " << result << endl;

    return 0;
}
