#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx")
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
template <typename T>
T modinv(T a, T m) {
  T b = m, u = 1, v = 0;
  while (b) {
    T t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
template <typename T>
T modpow(T x, int k) {
  if (k == 0) return 1;
  if (k % 2 == 0)
    return modpow(x * x, k / 2);
  else
    return x * modpow(x, k - 1);
}
template <int mod>
class modint {
 public:
  long long int val;
  modint(long long int a) { val = a % mod; }
  modint operator+(const modint& r) {
    return modint((this->val + r.val) % mod);
  }
  modint operator-(const modint& r) {
    return modint((this->val - r.val) % mod +
                  ((this->val - r.val) % mod < 0) * mod);
  }
  modint operator*(const modint& r) {
    return modint((((this->val % mod) * (r.val % mod))) % mod);
  }
  modint operator/(const modint& r) {
    return modint(this->val * modinv<long long int>(r.val, mod) % mod);
  }
  modint& operator+=(const modint& r) {
    *this = *this + r;
    return *this;
  }
  modint& operator-=(const modint& r) {
    *this = *this - r;
    return *this;
  }
  modint& operator*=(const modint& r) {
    *this = *this * r;
    return *this;
  }
  modint& operator/=(const modint& r) {
    *this = *this / r;
    return *this;
  }
};
int main() {
  int N;
  cin >> N;
  vector<long long int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  vector<int> B(62, 0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 62; j++) {
      if (A[i] & (1LL << j)) B[j]++;
    }
  }
  modint<MOD> ans = 0;
  for (int i = 0; i < 62; i++) {
    ans += modint<MOD>(B[i] * (N - B[i])) * modpow(modint<MOD>(2), i);
  }
  cout << ans.val << endl;
}
