#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<uint64_t> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<int> cnt1(60, 0);
  for (uint64_t a_i : a) {
    int i = 0;
    while (a_i > 0) {
      if (a_i % 2 == 1) cnt1[i]++;
      a_i /= 2;
      i++;
    }
  }
  vector<int64_t> ans(60);
  for (int i = 0; i < (int)(60); i++) {
    int cnt1_i = cnt1[i];
    ans[i] = cnt1_i * (n - cnt1_i);
  }
  int ANS = 0;
  for (int i = 59; i >= 0; i--) {
    ANS = (2 * ANS + ans[i]) % 1000000007;
  }
  cout << ANS << endl;
}
