#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long pow_mod(long long a, long long b, long long p) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % p;
    a = (a * a) % p;
    b >>= 1;
  }
  return ret;
}
long long Fermat(long long a, long long p) { return pow_mod(a, p - 2, p); }
int main() {
  int n;
  cin >> n;
  vector<long long> arr(n);
  vector<long long> ct(60, 0);
  for (int i = 0; i < n; ++i) {
    long long curr;
    cin >> curr;
    arr[i] = curr;
    for (long long j = 0; j < 60; ++j) {
      if (((1LL << j) & curr) > 0) {
        ct[j]++;
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    long long curr = arr[i];
    for (long long j = 0; j < 60; ++j) {
      if (((1LL << j) & curr) > 0) {
        res += 1LL * (n - ct[j]) * (1LL << j);
        res %= mod;
      } else {
        res += 1LL * ct[j] * (1LL << j);
        res %= mod;
      }
    }
  }
  long long md = 1e9 + 7;
  res *= Fermat(2, md);
  res %= mod;
  cout << res << endl;
  return 0;
}
