#include <bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;
i64 B[2][63];
int main() {
  const i64 mod = 1e9 + 7LL;
  int n;
  cin >> n;
  vl a(n);
  for (auto&& x : a) cin >> x;
  for (auto&& x : a) {
    for (int i = 0; i < 61; i++) {
      i64 mask = (1LL << i);
      if (x & mask)
        B[1][i]++;
      else
        B[0][i]++;
    }
  }
  i64 ans = 0LL;
  for (int i = 0; i < 61; i++) {
    ans += B[0][i] % mod * B[1][i] % mod * (1LL << i) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
