#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
ll INF = 1e+18;
int iINF = 1e9;
int main() {
  int N;
  cin >> N;
  vector<ll> arr(N);
  for (ll i = (0); (i) < (N); i++) cin >> arr[i];
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    ll one = 0;
    ll zero = 0;
    for (ll k = (0); (k) < (N); k++) {
      if ((arr[k] & (1LL << i)))
        ++one;
      else
        ++zero;
    }
    ll add = ((one * zero) * (ll)pow(2, i)) % (ll)1000000007;
    ans = (ans + add) % (ll)1000000007;
  }
  cout << ans << endl;
}
