#include <bits/stdc++.h>
using namespace std;
template <long long mod>
struct ModInt {
  long long x;
  ModInt() : x(0) {}
  ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod)) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (long long)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    long long t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  ModInt inverse() const {
    long long a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return ModInt(u);
  }
  ModInt pow(long long e) const {
    long long a = 1, p = x;
    while (e > 0) {
      if (e % 2 == 0) {
        p = (p * p) % mod;
        e /= 2;
      } else {
        a = (a * p) % mod;
        e--;
      }
    }
    return ModInt(a);
  }
};
using modint = ModInt<1000000007>;
modint modpow(long long a, long long N) {
  if (N == 0) {
    modint tmp = 1;
    return tmp;
  }
  if (N % 2 == 1) {
    modint tmp = a;
    return tmp * modpow(a, N - 1);
  }
  modint tmp = modpow(a, N / 2);
  return (tmp * tmp);
}
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long keta = 0, tmp = *max_element(A.begin(), A.end());
  while (tmp > 0) {
    tmp /= 2;
    keta++;
  }
  vector<pair<long long, long long>> dig(keta);
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < keta; j++) {
      if (A[i] & (1 << j))
        dig[j].first++;
      else
        dig[j].second++;
    }
  }
  modint ans = 0;
  for (long long i = 0; i < keta; i++) {
    modint t = modpow(2, i);
    t *= dig[i].first;
    t *= dig[i].second;
    ans += t;
  }
  cout << ans << endl;
}
