#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int maxi = -1;
void push(vector<vector<Int>>& bitcnt, Int num) {
  for (int i = 0; i < bitcnt[0].size(); ++i) {
    Int bit = num & 1;
    bitcnt[bit][i] += 1;
    num >>= 1;
  }
  return;
};
int main() {
  constexpr Int mod = 1e9 + 7;
  Int ans = 0;
  vector<vector<Int>> bitcnt(2, vector<Int>(62, 0LL));
  int N;
  cin >> N;
  vector<Int> v(N);
  for (auto& e : v) cin >> e;
  reverse(v.begin(), v.end());
  for (int i = 0; i < N; ++i) {
    if (i != 0) {
      Int num = v[i];
      for (int i = 0; i + 1 < bitcnt[0].size(); ++i) {
        Int bit = num & 1;
        ans += (1LL << i) * bitcnt[not bit][i];
        ans %= mod;
        num >>= 1;
      }
    }
    push(bitcnt, v[i]);
  }
  cout << ans << endl;
}
