#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n;
int sum[64] = {0};
void B(long long x) {
  int pos = 0;
  while (x) {
    if (x % 2 == 1) sum[pos]++;
    pos++;
    x / 2;
  }
}
int main() {
  cin >> n;
  long long a;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a);
    B(a);
  }
  long long mul = 1;
  long long ans = 0;
  for (int i = 0; i <= 62; i++) {
    long long a, b;
    a = sum[i];
    b = n - a;
    a = min(a, b);
    a = (a % MOD * mul % MOD) % MOD;
    mul *= 2;
    mul = mul % MOD;
    ans += a;
    ans %= MOD;
  }
  cout << ans;
  return 0;
}
