#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<long long>;
using pll = pair<long, long>;
template <class T>
using pr = pair<T, T>;
template <class T>
using vec = vector<T>;
constexpr int INF = 2000000100;
constexpr ll MOD = 1000000007;
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
T divup(T a, T b) {
  if (a % b == 0) {
    return a / b;
  }
  return a / b + 1;
}
std::string strMulti(std::string t, int n) {
  std::string out = "";
  for (int i = 0; i < n; i++) {
    out += t;
  }
  return out;
}
template <class T>
T math_P(T m, T n) {
  T ret = 1;
  for (T i = m; i > m - n; i--) {
    ret *= i;
  }
  return ret;
}
template <class T>
T math_C(T m, T n) {
  T ret = mathP(m, n);
  for (T i = 2; i <= n; i++) {
    ret /= i;
  }
  return ret;
}
template <class T>
bool compare_by_b(pair<T, T> a, pair<T, T> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  }
  return a.first < b.first;
}
template <class T>
T mod_pow(T x, T n, const T& p) {
  T ret = 1;
  while (n > 0) {
    if (n & 1) {
      (ret *= x) %= p;
    }
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
void Main() {
  ll N;
  cin >> N;
  vecll A(N);
  for (int i = 0, i_len = (N); i < i_len; i++) cin >> A[i];
  ll res = 0;
  for (int d = 0, d_len = (60); d < d_len; d++) {
    ll n0 = 0, n1 = 0;
    for (int i = 0, i_len = (N); i < i_len; i++) {
      if ((A[i] >> d) && 1)
        n1++;
      else
        n0++;
    }
    ll tmp = (1ll << d) % MOD;
    ll n = (n0 * n1) % MOD;
    tmp = (tmp * n) % MOD;
    res = (res + tmp) % MOD;
  }
  cout << res;
}
int main() {
  Main();
  return 0;
}
