document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /* e275             */
  2. /* AC (0.1s, 116KB) */
  3. #pragma warning( disable : 4996 )
  4. #include <cstdio>
  5. #include <cstring>
  6. #include <cstdint>
  7. #include <cmath>
  8. #include <algorithm>
  9. #include <tuple>
  10. #define ios_jazz ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
  11.  
  12. using namespace std;
  13.  
  14. using int16 = short;
  15. using uint16 = unsigned short;
  16. using int32 = int;
  17. using uint = unsigned int;
  18. using int64 = long long;
  19. using uint64 = unsigned long long;
  20. using pii = pair<int, int>;
  21.  
  22. /* main code */
  23.  
  24. bool isParityZero(uint64 x)
  25. {
  26.     for (int i = 32; i; i >>= 1)
  27.         x = x ^ (x >> i);
  28.     return !(x & 1);
  29. }
  30.  
  31. constexpr uint MAXN = 100000;
  32. uint n, arr[2];
  33. uint64 x;
  34.  
  35. int main()
  36. {
  37.     while (~scanf("%u", &n))
  38.     {
  39.         arr[0] = arr[1] = 0;
  40.         for (uint i = 0; i < n; ++i)
  41.         {
  42.             scanf("%llu", &x);
  43.             ++arr[!isParityZero(x)];
  44.         }
  45.         if (n == 1)
  46.             puts("0");
  47.         else
  48.             printf("%llu\\n", (uint64)n * (n - 1) / 2 - arr[0] * arr[1]);
  49.     }
  50.     return 0;
  51. }
');