#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<long long>;
using VVL = vector<vector<long long>>;
using VP = vector<P>;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  VL a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  long long ans = 0;
  long long d = 1;
  for (int i = 0; i < (int)(60); i++) {
    long long cnt0 = 0, cnt1 = 0;
    for (int j = 0; j < (int)(n); j++) {
      if (a[j] >> i & 1)
        cnt1++;
      else
        cnt0++;
    }
    ans += d * (cnt1 * cnt0) % mod;
    ans %= mod;
    d *= 2;
    d %= mod;
  }
  cout << ans << endl;
  return 0;
}
