#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
template <typename T>
inline void priv(vector<T> a) {
  for (int i = 0; i < a.size(); i++) {
    cerr << a[i] << ((i == a.size() - 1) ? "\n" : " ");
  }
}
inline void fastio() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
int_fast64_t gcd(int_fast64_t a, int_fast64_t b) {
  int_fast64_t c = max(a, b);
  int_fast64_t d = min(a, b);
  return c == 0 || d == 0 ? c : gcd(c % d, d);
}
int_fast64_t lcm(int_fast64_t a, int_fast64_t b) {
  return a == 0 || b == 0 ? 0 : a * b / gcd(a, b);
}
int_fast64_t modfact(int_fast64_t a) {
  int_fast64_t b = 1;
  for (int i = 2; i <= a; i++) b = b * i % 1000000007LL;
  return b;
}
int_fast64_t modpow(int_fast64_t a, int_fast64_t n) {
  int_fast64_t b = 1;
  while (n > 0) {
    if (n & 1) b = b * a % 1000000007LL;
    a = a * a % 1000000007LL;
    n >>= 1;
  }
  return b;
}
int_fast64_t modcomb(int_fast64_t n, int_fast64_t k) {
  int_fast64_t b = 1;
  k = min(n - k, k);
  for (int i = n; i >= n - k + 1; i--) b = b * i % 1000000007LL;
  return b * modpow(modfact(k), 1000000007LL - 2) % 1000000007LL;
}
int_fast64_t N;
vector<int_fast64_t> A;
int main() {
  fastio();
  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  int_fast64_t ans = 0;
  for (int x = 0; x <= 60; x++) {
    int_fast64_t cnt = 0;
    for (int i = 0; i < N; i++)
      if ((A[i] >> x) & 1LL) cnt++;
    int_fast64_t tmp = (1LL << x) % 1000000007LL;
    ans = (ans + tmp * (cnt * (N - cnt)) % 1000000007LL) % 1000000007LL;
  }
  cout << ans << endl;
  return 0;
}
