#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  long long sum = 0;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < 62; ++i) {
    long long cnt1 = 0;
    long long cnt0 = 0;
    for (long long j = 0; j < n; ++j) {
      if ((1ll << i) & a[j])
        cnt1++;
      else
        cnt0++;
    }
    sum += (((cnt1 * (1ll << i)) % mod) * cnt0) % mod;
    sum %= mod;
  }
  cout << sum;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  for (int i = 1; i <= t; ++i) {
    solve();
  }
}
