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