#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <int MOD>
struct ModInt {
  int val;
  ModInt(ll v = 0) : val(v % MOD) {
    if (val < 0) val += MOD;
  };
  ModInt operator+() const { return ModInt(val); }
  ModInt operator-() const { return ModInt(MOD - val); }
  ModInt inv() const { return this->pow(MOD - 2); }
  ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
  ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
  ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
  ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
  ModInt& operator+=(const ModInt& x) {
    if ((val += x.val) >= MOD) val -= MOD;
    return *this;
  }
  ModInt& operator-=(const ModInt& x) {
    if ((val -= x.val) < 0) val += MOD;
    return *this;
  }
  ModInt& operator*=(const ModInt& x) {
    val = (ll(val) * x.val) % MOD;
    return *this;
  }
  ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
  ModInt pow(ll n) const {
    auto x = ModInt(1);
    auto b = *this;
    while (n > 0) {
      if (n & 1) x *= b;
      n >>= 1;
      b *= b;
    }
    return x;
  }
  bool operator==(const ModInt& b) const { return val == b.val; }
  bool operator!=(const ModInt& b) const { return val != b.val; }
  friend istream& operator>>(istream& is, ModInt& x) noexcept {
    return is >> x.val;
  }
  friend ostream& operator<<(ostream& os, const ModInt& x) noexcept {
    return os << x.val;
  }
};
const int MOD = 1e9 + 7;
using mint = ModInt<MOD>;
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
};
mint nCr(int n, int r) {
  assert(!(n < r));
  assert(!(n < 0 || r < 0));
  mint ans = 1;
  for (int i = 1; i <= r; i++) {
    ans *= n - i + 1;
    ans /= i;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<int> v(65);
  for (int i = 0; i < (65); ++i) v[i] = 0;
  for (int i = 0; i < (n); ++i) {
    ll a;
    cin >> a;
    int temp = 0;
    for (int j = 0; j < (60); ++j) {
      if (a % 2 == 1) v[j]++;
      a = a / 2;
    }
  }
  mint ans = 0;
  mint temp2 = 1;
  for (int i = 0; i < (60); ++i) {
    mint hoge = ((n - v[i]) * v[i]);
    ans += hoge * temp2;
    temp2 *= 2;
  }
  cout << ans << endl;
  return 0;
}
