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