#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long N, A[312345];
long long mod = 1000000007;
int main() {
  cin >> N;
  for (long long i = 0; i < (N); ++i) cin >> A[i];
  long long sum = 0;
  for (long long i = 0; i < (N); ++i) {
    sum += A[i];
    sum %= mod;
  }
  vector<long long> counter(60);
  for (long long b = 0; b < (60); ++b) {
    for (long long i = 0; i < (N); ++i) {
      if ((A[i] >> b) & 1) counter[b]++;
    }
  }
  long long ans = sum * N % mod;
  for (long long i = 0; i < (N); ++i) {
    vector<long long> bts;
    for (long long b = 0; b < (60); ++b) {
      if ((A[i] >> b) & 1) bts.push_back(b);
    }
    for (auto b : bts) {
      ans += (1ll << b) % mod * (N - 2 * counter[b]);
      ans %= mod;
    }
  }
  if (ans < 0) ans += mod;
  cout << ans / 2 << endl;
  return 0;
}
