#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
const long long MOD = 1e9 + 7;
signed main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = (0); i < (N); i++) cin >> A[i];
  const int DIGIT_NUM = 60;
  vector<int> oneCountPerDigit(DIGIT_NUM);
  for (long long i = (0); i < (N); i++) {
    for (long long d = (0); d < (DIGIT_NUM); d++) {
      if ((1LL << d) & A[i]) oneCountPerDigit[d]++;
    }
  }
  long long answer = 0;
  long long multiplier = 1;
  for (long long d = (0); d < (DIGIT_NUM); d++) {
    long long add = oneCountPerDigit[d] * (N - oneCountPerDigit[d]);
    add *= multiplier;
    add %= MOD;
    answer += add;
    answer %= MOD;
    multiplier *= 2;
    multiplier %= MOD;
  }
  cout << answer << "\n";
  return 0;
}
