#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<unsigned long long> vec(n);
  int t[62] = {0};
  unsigned long long ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
    for (int j = 0; j < 62; j++) {
      if (((vec[i] >> j) & 1) == 1) {
        t[j]++;
      }
    }
  }
  unsigned long long s = 1;
  unsigned long long u;
  for (int i = 0; i < 62; i++, s *= 2) {
    ans += (n - t[i]) * t[i] * (s % 1000000007);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
