#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  ll cnt{};
  vector<int> sum(60);
  vector<bitset<60>> a(n);
  for (int i = 0; i < n; i++) {
    ll b;
    cin >> b;
    a.at(i) = bitset<60>(b);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (a.at(i).test(j)) sum.at(j)++;
    }
  }
  for (int i = 0; i < n; i++) {
    ll p{1};
    for (int j = 0; j < 60; j++) {
      if (a.at(i).test(j)) {
        (cnt += ((n - sum.at(j)) * p) % MOD) %= MOD;
      } else {
        (cnt += ((sum.at(j)) * p) % MOD) %= MOD;
      }
      p <<= 1;
      p %= MOD;
    }
  }
  cout << cnt / 2 << endl;
}
