#include <bits/stdc++.h>
using namespace std;
using LL = long long;
template <typename T>
using V = vector<T>;
using Vi = V<int>;
using Vll = V<LL>;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  Vll a(n);
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i];
  Vll num_one_bit(65, 0);
  for (int(i) = 0; (i) < (n); (i)++) {
    int b = 0;
    LL tmp = a[i];
    while (tmp > 0) {
      num_one_bit[b] += tmp % 2;
      tmp /= 2;
      b++;
    }
  }
  LL total = 0;
  LL two_pow = 1;
  for (int(i) = 0; (i) < (60); (i)++) {
    LL xor_sum = (num_one_bit[i] * (n - num_one_bit[i])) % MOD;
    total = (total + (xor_sum * two_pow) % MOD) % MOD;
    two_pow *= 2;
  }
  cout << total << endl;
  return 0;
}
