#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  long long res = 0;
  long long power_of_two = 1;
  for (int i = 0; i < 60; ++i) {
    long long one = 0;
    for (long long &element : arr) {
      if (element % 2 == 1) {
        one++;
      }
      element /= 2;
    }
    res = (res + power_of_two * one * (n - one)) % MOD;
    power_of_two = (power_of_two * 2) % MOD;
  }
  cout << res << endl;
}
