#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<ll> A(60);
  long long num;
  for (int i = (int)(0); i < (int)(N); ++i) {
    cin >> num;
    for (int j = (int)(0); j < (int)(60); ++j) {
      if ((num >> j) & 1) {
        A[j]++;
      }
    }
  }
  ll ans = 0;
  for (int i = (int)(0); i < (int)(60); ++i) {
    ans += (N - A[i]) * A[i] * pow(2, i);
    ans %= MOD;
  }
  cout << ans << endl;
}
