#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
  }
  ll ans = 0;
  ll two_factor = 1;
  for (int d = 0; d <= 60; d++) {
    int odd = 0;
    int even = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] & (1ll << d)) {
        ++odd;
      } else {
        ++even;
      }
    }
    ll p = odd * even;
    ans += p * two_factor;
    ans %= mod;
    two_factor = two_factor * 2;
    two_factor %= mod;
  }
  cout << ans << endl;
  return 0;
}
