#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}
const long long MOD = 1000000007;
void solve(long long N, std::vector<long long> A) {
  vector<ll> v(60);
  for (ll i = 0; i < 60; i++) {
    ll x = 0;
    for (ll j = 0; j < N; j++) {
      if (A[j] & (1ull << i)) x++;
    }
    v[i] = x;
  }
  for (ll i = 0; i < 60; i++) {
    v[i] = v[i] * (N - v[i]);
  }
  ll ans = 0;
  for (ll i = 0; i + 1 < 60; i++) {
    ll x = v[i] % 2;
    ans |= x << i;
    v[i + 1] += v[i] / 2;
  }
  std::cout << ans % MOD << std::endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
