#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U>
using P = pair<T, U>;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
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;
}
const int INF = 1001001001;
int main() {
  ll N;
  cin >> N;
  ll a[N];
  vec<ll> num_digits(60, 0);
  for (int(i) = 0; (i) < (N); (i)++) {
    int aa;
    cin >> aa;
    a[i] = aa;
    for (int(bit) = 0; (bit) < (60); (bit)++) {
      num_digits[bit] += aa % 2;
      aa /= 2;
    }
  }
  ll mod = 1000000000 + 7;
  ll ans = 0;
  double res = 0;
  for (int(i) = 0; (i) < (N); (i)++)
    for (int(bit) = 0; (bit) < (60); (bit)++) {
      if (a[i] % 2 == 1) {
        ans += pow(2, bit) * (N - num_digits[bit]) / 2;
        if (int(pow(2, bit) * (N - num_digits[bit])) % 2 == 1) res += 0.5;
      } else {
        ans += pow(2, bit) * num_digits[bit] / 2;
        if (int(pow(2, bit) * num_digits[bit]) % 2 == 1) res += 0.5;
      }
      ans %= mod;
      a[i] /= 2;
    }
  ans = ans + res;
  ans %= mod;
  cout << ans << endl;
}
