#include <bits/stdc++.h>
using namespace std;
long long debugFlag = false;
template <typename T>
void debug(T&);
template <typename T>
void debug(T&, bool);
template <typename T>
void debug(vector<T>&);
template <typename T>
void debug(vector<T>&, bool);
template <typename T, typename U>
void debug(pair<T, U>&);
template <typename T, typename U>
void debug(pair<T, U>&, bool);
template <typename T>
void debug(T& obj) {
  debug(obj, true);
}
template <typename T>
void debug(T& obj, bool lnFlag) {
  if (!debugFlag) return;
  cout << obj;
  if (lnFlag) cout << endl;
}
template <typename T>
void debug(vector<T>& obj) {
  debug(obj, true);
}
template <typename T>
void debug(vector<T>& obj, bool lnFlag) {
  if (!debugFlag) return;
  cout << "[";
  for (long long i = 0; i < obj.size(); i++) {
    if (i != 0) cout << ",";
    debug(obj[i], false);
  }
  cout << "]";
  if (lnFlag) cout << endl;
}
template <typename T, typename U>
void debug(pair<T, U>& obj) {
  debug(obj, true);
}
template <typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
  if (!debugFlag) return;
  cout << "(";
  debug(obj.first, false);
  cout << ",";
  debug(obj.second, false);
  cout << ")";
  if (lnFlag) cout << endl;
}
void solve() {
  long long MOD = 1e9 + 7;
  long long N;
  cin >> N;
  vector<long long> zero_sum(61, 0);
  vector<long long> one_sum(61, 0);
  vector<long long> vec(N);
  for (long long i = 0; i < N; i++) {
    cin >> vec[i];
  }
  long long ans = 0;
  for (long long i = N - 1; i > 0; i--) {
    for (long long j = 0; j < 61; j++) {
      if (((vec[i] >> j) & 1) == 0)
        zero_sum[j]++;
      else
        one_sum[j]++;
    }
    for (long long j = 0; j < 61; j++) {
      if (((vec[i - 1] >> j) & 1) == 1)
        ans = (ans + zero_sum[j] * (1ull << j)) % MOD;
      else
        ans = (ans + one_sum[j] * (1ull << j)) % MOD;
    }
  }
  cout << ans;
}
int main(int argc, char* argv[]) {
  if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
  solve();
  return 0;
}
