#include <bits/stdc++.h>
using namespace std;
constexpr int64_t MOD = 1e9 + 7;
int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (auto& a : A) {
    cin >> a;
  }
  int64_t ans = 0;
  int64_t t = 1;
  for (int bit = 0; bit < 60; ++bit) {
    int one = 0;
    for (auto a : A) {
      if ((a >> bit) & 1) ++one;
    }
    ans += ((one * (N - one)) % MOD) * (t % MOD);
    ans %= MOD;
    t <<= 1;
  }
  cout << ans << endl;
  return 0;
}
