#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
#pragma GCC target("avx")
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
T gcd(T a, T b) {
  if (a < b) std::swap(a, b);
  while (b) std::swap(a %= b, b);
  return a;
}
template <class T>
T lcm(const T a, const T b) {
  return a / gcd(a, b) * b;
}
using ll = long signed long;
using ull = long unsigned long;
using ld = long double;
using namespace std;
struct inp {
  size_t sz;
  inp(size_t _sz = 1) : sz(_sz) {}
  template <typename T>
  operator T() const {
    T a;
    cin >> a;
    return a;
  }
  template <typename T>
  operator vector<T>() const {
    vector<T> a(sz);
    for (size_t i = 0; i < sz; i++) cin >> a[i];
    return a;
  }
  template <typename T, typename U>
  operator pair<T, U>() const {
    T f;
    U s;
    cin >> f >> s;
    return pair<T, U>(f, s);
  }
};
inp inp1;
template <typename T>
void say(T &x, char end = '\n') {
  cout << x << end;
}
template <typename T>
void say(vector<T> &x, char sep = ' ', char end = '\n') {
  for (size_t i = 0, sz = x.size(); i < sz; i++) {
    cout << x[i] << (i == sz - 1 ? end : sep);
  }
}
constexpr ll pdiv = (ll)1e9 + 7;
ll powll(ll a, ll n) {
  ll result = 1;
  ll base = a;
  ll mask = 1;
  while (mask <= n) {
    if (n & mask) (result *= base) %= pdiv;
    mask <<= 1;
    (base *= base) %= pdiv;
  }
  return result;
}
inline ll invll(ll a) { return powll(a, pdiv - 2); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n = inp1;
  vector<ll> a = inp(n);
  constexpr ll dcnt = 60;
  vector<ll> bcnt(dcnt, 0);
  for (long long i = 0, i_len = (n); i < i_len; i++)
    for (long long j = 0, j_len = (dcnt); j < j_len; j++) {
      if (a[i] >> j & 1) {
        bcnt[j]++;
      }
    }
  ll ans = 0;
  for (long long i = 0, i_len = (n); i < i_len; i++) {
    ll term = 0;
    for (long long j = 0, j_len = (dcnt); j < j_len; j++) {
      if (a[i] >> j & 1) {
        ll aite = n - bcnt[j];
        (ans += aite * (1LL << j)) %= pdiv;
      } else {
        ll aite = bcnt[j];
        (ans += aite * (1LL << j)) %= pdiv;
      }
    }
  }
  (ans *= invll(2)) %= pdiv;
  say(ans);
}
