#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 2;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  constexpr int MOD = 1000000007;
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = (0); i < (N); ++i) {
    cin >> A[i];
  }
  ll ans = 0;
  for (ll i = 0; i < 60; i++) {
    ll bit = 1LL << i;
    int ones = 0;
    int zeros = 0;
    for (int j = (0); j < (N); ++j) {
      if (bit & A[j]) {
        ones++;
      } else {
        zeros++;
      }
    }
    int p = ones * zeros;
    ll mbit = bit % MOD;
    mbit *= p;
    mbit %= MOD;
    ans += mbit;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
