#include <bits/stdc++.h>
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
int main() {
  long long N, ans = 0;
  cin >> N;
  long long A[N];
  for (int i = (0); i < (N); ++i) cin >> A[i];
  for (long long i = 0; i < 60; ++i) {
    long long cnt = 0;
    for (long long j = 0; j < N; ++j) {
      if (A[j] & (1 << i)) cnt++;
    }
    ans += cnt * (N - cnt) * (1 << i) / 2;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
