#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <class T>
inline bool chmax(T &a, const T &b) {
  if (a >= b) return false;
  a = b;
  return true;
}
template <class T>
inline bool chmin(T &a, const T &b) {
  if (a <= b) return false;
  a = b;
  return true;
}
int X[4] = {0, 1, 0, -1}, Y[4] = {1, 0, -1, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  long long a[n];
  int num[61][2] = {};
  for (long long i = (long long)0; i < (long long)n; i++) {
    cin >> a[i];
    for (long long j = (long long)0; j < (long long)60; j++) {
      num[j][(a[i] >> j) & 1]++;
    }
  }
  long long ans = 0;
  for (long long i = (long long)0; i < (long long)60; i++)
    (ans += (1ll << i) % mod * num[i][0] * num[i][1]) %= mod;
  cout << ans << endl;
}
