#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll atcoder_mod = 1e9 + 7;
template <typename T = ll>
T in() {
  T x;
  cin >> x;
  return (x);
}
template <typename T = ll, typename C = vector<T>>
C vecin(int N) {
  C x(N);
  for (ll i = 0; i < (N); ++i) {
    x[i] = in<T>();
  }
  return move(x);
}
void vout() { cout << endl; }
template <typename Head, typename... Tail>
void vout(Head&& h, Tail&&... t) {
  cout << ' ' << h;
  vout(forward<Tail>(t)...);
}
void out() { cout << endl; }
template <typename Head, typename... Tail>
void out(Head&& h, Tail&&... t) {
  cout << h;
  vout(forward<Tail>(t)...);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  ll N = in();
  auto A = vecin(N);
  vector<ll> Z(60, 0), O(60, 0);
  for (ll i = 0; i < (N); ++i) {
    auto V = A[i];
    for (ll index = 0; index < (60); ++index) {
      if (V & 1LL)
        O[index]++;
      else
        Z[index]++;
      V /= 2LL;
    }
  }
  ll S = 0, K = 1;
  for (ll i = 0; i < (60); ++i) {
    auto X = O[i] * Z[i];
    X %= atcoder_mod;
    S += (X * K) % atcoder_mod;
    S %= atcoder_mod;
    K *= 2LL;
  }
  out(S);
  return 0;
}
