#include <bits/stdc++.h>
using namespace std;
int main() {
  const int digit = 60;
  long long N;
  cin >> N;
  vector<long long> A(N);
  vector<int> countBit(digit, 0);
  for (int(i) = 0; (i) < (N); ++(i)) {
    cin >> A[i];
    for (int(j) = 0; (j) < (digit); ++(j)) {
      if (((A[i] >> j) & 1) == 1) countBit[j]++;
    }
  }
  vector<long long> res(digit);
  res[0] = 1;
  for (int i = 1; i < digit; ++i) res[i] = (res[i - 1] * 2) % 1000000007;
  long long ans = 0;
  for (int(i) = 0; (i) < (digit); ++(i)) {
    ans += res[i] * (N - countBit[i]) * countBit[i];
    ans = ans % 1000000007;
  }
  cout << ans << endl;
}
