#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (ll)1e9 + 7;
template <int Mod>
struct ModInt {
  ll v;
  ModInt() : v(0) {}
  template <typename T>
  explicit ModInt(T t) {
    v = t % Mod;
    if (v < 0) v += Mod;
  }
  ModInt pow(int k) {
    ModInt res(1), x(v);
    while (k) {
      if (k & 1) res *= x;
      x *= x;
      k >>= 1;
    }
    return res;
  }
  template <typename T>
  ModInt &operator=(T a) {
    v = a % Mod;
    if (v < 0) v += Mod;
    return *this;
  }
  ModInt inv() { return pow(Mod - 2); }
  ModInt &operator+=(ModInt a) {
    v += a.v;
    if (v >= Mod) v -= Mod;
    return *this;
  }
  ModInt &operator-=(ModInt a) {
    v += Mod - a.v;
    if (v >= Mod) v -= Mod;
    return *this;
  }
  ModInt &operator*=(ModInt a) {
    v = 1LL * v * a.v % Mod;
    return *this;
  }
  ModInt &operator/=(ModInt a) {
    assert(a.v != 0);
    return (*this) *= a.inv();
  }
  ModInt operator+(ModInt a) const { return ModInt(v) += a; }
  ModInt operator-(ModInt a) const { return ModInt(v) -= a; }
  ModInt operator*(ModInt a) const { return ModInt(v) *= a; }
  ModInt operator/(ModInt a) const { return ModInt(v) /= a; }
  ModInt operator-() { return ModInt(-v); }
  bool operator==(const ModInt a) const { return v == a.v; }
  bool operator!=(const ModInt a) const { return v != a.v; }
  bool operator<(const ModInt a) const { return v < a.v; }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &a) {
    return os << a.v;
  }
  friend std::istream &operator>>(std::istream &is, ModInt &a) {
    int val;
    is >> val;
    a = ModInt(val);
    return is;
  }
};
using mint = ModInt<MOD>;
int main() {
  int n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  mint ans(0);
  ll max_v = *max_element(v.begin(), v.end());
  ll t = log2(max_v) + 1;
  for (int j = 0; j < t; j++) {
    ll sum = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] & (1 << j)) sum++;
    }
    if (sum) ans += mint(1 << j) * mint(sum) * mint(n - sum);
  }
  cout << ans << "\n";
}
