#include <bits/stdc++.h>
using namespace std;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1},
          dy[] = {0, -1, 0, 1, 1, -1, 1, -1};
const unsigned long long MOD = 1e9 + 7;
template <typename T>
inline T GCD(T a, T b) {
  T c;
  while (b != 0) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}
template <typename T>
inline T LCM(T a, T b) {
  T c = GCD(a, b);
  a /= c;
  return a * b;
}
template <typename T>
inline T nCr(T a, T b) {
  T i, r = 1;
  for (i = 1; i <= b; i++) {
    r *= (a + 1 - i);
    r /= i;
  }
  return r;
}
template <typename T>
inline T nHr(T a, T b) {
  return nCr(a + b - 1, b);
}
struct edge2 {
  long long to, cost;
};
struct edge3 {
  long long from, to, cost;
};
signed main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  unsigned long long N, A[300000];
  cin >> N;
  unsigned long long onecnt[62] = {}, zerocnt[62] = {};
  for (long long i = 0; i < (N); ++i) {
    cin >> A[i];
    for (long long j = 0; j < (62); ++j) {
      if ((A[i] >> j) & 1)
        onecnt[j]++;
      else
        zerocnt[j]++;
    }
  }
  unsigned long long ans = 0;
  for (long long i = 0; i < (N); ++i) {
    for (long long j = 0; j < (62); ++j) {
      if ((A[i] >> j) & 1) {
        ans += ((1ull << j) * zerocnt[j]) % MOD;
      } else {
        ans += ((1ull << j) * onecnt[j]) % MOD;
      }
      ans %= MOD;
    }
  }
  cerr << ans << '\n';
  cout << (ans * ((MOD + 1) / 2)) % MOD << '\n';
}
