#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
string alphabet_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alphabet_lower = "abcdefghijklmnopqrstuvwxyz";
int main(void) {
  ull N;
  cin >> N;
  ull A[N];
  int zero_num[60], one_num[60];
  for (int i = 0; i < 60; i++) zero_num[i] = 0, one_num[i] = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    for (int j = 0; j < 60; j++) {
      if (A[i] >> j & 1)
        one_num[j]++;
      else
        zero_num[j]++;
    }
  }
  ull ans = 0;
  for (int i = 0; i < 60; i++) {
    ans += (ull)pow(2, i) * (one_num[i] * zero_num[i]);
    ans %= (ull)(1e+9) + 7;
  }
  cout << ans << endl;
}
