#include <bits/stdc++.h>
using namespace std;
int64_t INF = 1e18;
int64_t mod = 1e9 + 7;
int main() {
  int64_t n;
  cin >> n;
  vector<int64_t> a(n);
  for (int64_t i = 0; i < n; i++) {
    cin >> a[i];
  }
  int64_t b[70][2] = {};
  for (int64_t i = 0; i < n; i++) {
    int64_t x = 0;
    for (int64_t j = 0; j < 62; j++) {
      b[j][a[i] % 2]++;
      a[i] /= 2;
    }
  }
  int64_t res = 0;
  for (int64_t i = 0; i < 62; i++) {
    int64_t add = b[i][0] * b[i][1] % mod;
    add = add * (1LL << i) % mod;
    res += add;
    res %= mod;
  }
  cout << (res) << endl;
  return 0;
}
