#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int64_t> Ai;
  for (int i = 0; i < (int)(N); i++) {
    int64_t tmpAi;
    cin >> tmpAi;
    Ai.push_back(tmpAi);
  }
  int64_t ans = 0;
  int64_t pow2n = 0;
  for (int i = 0; i < (int)(61); i++) {
    int64_t zero = 0;
    int64_t one = 0;
    int64_t digitSum = 0;
    pow2n = i;
    for (int j = 0; j < (int)(N); j++) {
      if ((1LL << pow2n) & Ai.at(j)) one++;
    }
    zero = N - one;
    digitSum = (zero * one) % 1000000007;
    ans += digitSum * (1LL << pow2n);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
