#include <bits/stdc++.h>
using namespace std;

#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

const cpp_int MOD = 1000000007;

int main() {
  cpp_int n;
  cin >> n;
  vector<cpp_int> arr(n);
  for (cpp_int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  cpp_int res = 0;
  cpp_int power_of_two = 1;
  for (cpp_int i = 0; i < 60; ++i) {
    cpp_int one = 0;
    for (cpp_int &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;
}
