#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long mod = pow(10, 9) + 7;
  vector<long long> dp(60);
  dp.at(0) = 1;
  for (long long i = 0; i < 59; ++i) {
    dp.at(i + 1) = dp.at(i) * 2 % mod;
  }
  long long N;
  cin >> N;
  vector<long long> num(60, 0);
  for (long long i = 0; i < N; ++i) {
    long long a;
    cin >> a;
    for (long long j = 0; j < 60; ++j) {
      if ((a & dp.at(j)) != 0) {
        num.at(j) += 1;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 60; ++i) {
    long long temp = num.at(i) * (N - num.at(i)) % mod;
    temp = (temp * dp.at(i)) % mod;
    ans = (ans + temp) % mod;
  }
  cout << ans << "\n";
}
