#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> data(n);
  for (int i = (0); i < (n); ++i) {
    cin >> data[i];
  }
  long long ans = 0;
  for (int d = (0); d < (60); ++d) {
    int one_cnt = 0;
    for (int i = (0); i < (n); ++i) {
      if (data[i] >> d & 1) one_cnt++;
    }
    long long now = one_cnt * (n - one_cnt) % 1000000007;
    for (int j = (0); j < (d); ++j) {
      now *= 2;
      now %= 1000000007;
    }
    ans += now;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
