#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
int main() {
  int n;
  cin >> n;
  long long A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  long long sum = 0;
  long long cnt[61];
  for (long long b = 0; b < 61; b++) cnt[b] = 0;
  for (long long i = 0; i < n; i++)
    for (long long b = 0; b < 61; b++)
      if (A[i] & (1ull << b)) cnt[b]++;
  for (long long b = 0; b < 61; b++) {
    long long m =
        (cnt[b] * (n - cnt[b]) * ((1ull << b) % 1000000007)) % 1000000007;
    sum += m;
    sum %= 1000000007;
  }
  cout << sum << endl;
  return 0;
}
