#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int cnt[64];
int main() {
  ios::sync_with_stdio(0);
  cout << setprecision(10) << fixed;
  int n;
  cin >> n;
  vector<long long> a(n);
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    for (int j = 0; j < 60; ++j) {
      if ((1ll << j) & a[i]) cnt[j]++;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 60; ++j) {
      if ((1ll << j) & a[i]) cnt[j]--;
    }
    for (int j = 0; j < 60; ++j) {
      if ((1ll << j) & a[i]) {
        ans = (ans + (1ll << j) % MOD * (n - i - cnt[j] - 1) % MOD) % MOD;
      } else {
        ans = (ans + (1ll << j) % MOD * cnt[j] % MOD) % MOD;
      }
    }
  }
  cout << ans;
  return 0;
}
