#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline constexpr ll Inf = (1ULL << 62) - 1;
template <class T>
bool updmax(T& a, T b) {
  if (b > a) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool updmin(T& a, T b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
const ll Mod = (ll)1e9 + 7;
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ;
  ll ans = 0;
  ll N;
  cin >> N;
  vector<ll> a(N);
  for (ll i = 0; i < N; ++i) cin >> a[i];
  ll base = 1;
  for (ll i = 0; i < 60; ++i) {
    int zero = 0;
    for (ll j = 0; j < N; ++j) zero += !(a[j] & (1LL << i));
    ans += zero * (N - zero) * base % Mod;
    ans %= Mod;
    base = base * 2 % Mod;
  }
  cout << ans << '\n';
}
