#include <bits/stdc++.h>
using namespace std;
int main() {
  const long long mod = 1e9 + 7;
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  vector<long long> b(60, 0);
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < 60; j++) {
      if (a[i] & ((long long)1 << j)) b[j]++;
    }
  }
  long long ans = 0;
  long long coeff = 1;
  for (long long i = 0; i < 60; i++) {
    ans += b[i] * (n - b[i]) * (coeff % mod);
    coeff *= 2;
    ans = ans % mod;
  }
  cout << ans << endl;
}
