#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<ll> A(10);
  for (int i = 0; i < (N); i++) cin >> A[i];
  ll ans = 0;
  ll k = 1;
  for (int i = 0; i < (60); i++) {
    int c = 0;
    for (int j = 0; j < (N); j++) {
      c += A[j] & 1;
      A[j] >>= 1;
    }
    ans = (ans + (c * (N - c)) % 1000000007 * k % 1000000007) % 1000000007;
    k = (2 * k) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
