#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string lts(long long x) {
  stringstream second;
  second << x;
  return second.str();
}
long long stl(string x) {
  stringstream second(x);
  long long temp;
  second >> temp;
  return temp;
}
string cts(char x) {
  string second(1, x);
  return second;
}
const int MOD = 1e9 + 7;
const int MAXN = 305;
template <typename T>
void maxself(T& a, T b) {
  a = max(a, b);
}
template <typename T>
void minself(T& a, T b) {
  a = min(a, b);
}
long long A[300005];
long long ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (long long i = (1); i <= (long long)(n); ++i) {
    cin >> A[i];
  }
  for (long long i = (0); i <= (long long)(60); ++i) {
    long long c = 0;
    for (long long j = (1); j <= (long long)(n); ++j) {
      if ((1ll << i) & A[j]) {
        ++c;
      }
    }
    long long t = c * (n - c);
    t *= ((1ll << i) % MOD);
    t %= MOD;
    ans += t;
    ans %= MOD;
  }
  cout << ans;
}
