#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = (unsigned long long)(1000000007);
const unsigned long long maxn = 20;
const unsigned long long mm = 1e+18;
unsigned long long power(unsigned long long x, unsigned long long y) {
  unsigned long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
unsigned long long ncr(unsigned long long n, unsigned long long k) {
  unsigned long long C[k + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (unsigned long long i = 1; i <= n; i++) {
    for (unsigned long long j = min(i, k); j > 0; j--)
      C[j] = (C[j] + C[j - 1]) % mod;
  }
  return C[k];
}
void solve() {
  int n;
  cin >> n;
  unsigned long long arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  unsigned long long sum = 0;
  unsigned long long xx = 1LL;
  for (unsigned long long i = 0; i <= 64; i++) {
    unsigned long long zc = 0, oc = 0;
    unsigned long long idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2LL;
    }
    idsum = (oc * (zc * xx) % mod) % mod;
    sum = (sum + idsum) % mod;
    xx = (xx * 2LL) % mod;
  }
  cout << sum % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
