#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using graph = std::vector<std::vector<ll>>;
using namespace std;
int main() {
  ll N;
  cin >> N;
  unsigned long long A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll count[60];
  for (int i = 0; i < 60; i++) {
    count[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if (A[i] & (1ull << j)) {
        count[j]++;
      }
    }
  }
  ll MOD = 1000000000 + 7;
  ll result = 0;
  for (int i = 0; i < 60; i++) {
    result = (result + count[i] * (N - count[i]) * (1ull << i)) % MOD;
  }
  cout << result << endl;
}
