#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  int64_t ans = 0;
  int64_t tp = 1;
  for (int i = 0; i < 60; ++i) {
    int64_t a = 0, b = 0;
    for (int j = 0; j < N; ++j) {
      bitset<60> s(A[j]);
      if (s.test(i))
        ++a;
      else
        ++b;
    }
    ans += tp * a * b;
    ans %= MOD;
    tp *= 2;
    tp %= MOD;
  }
  cout << ans << endl;
}
