#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const int MAX_BIT = 62;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  ll A[N];
  for (int i = 0; i < (N); ++i) cin >> A[i];
  ll ans = 0;
  int bit[MAX_BIT];
  for (int i = 0; i < (MAX_BIT); ++i) bit[i] = 0;
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (MAX_BIT); ++j) {
      if (A[i] & (1LL << j)) ++bit[j];
    }
  }
  for (int i = 0; i < (N - 1); ++i) {
    ll tmp = 0;
    for (int j = 0; j < (MAX_BIT); ++j) {
      if (A[i] & (1LL << j)) --bit[j];
    }
    for (int j = 0; j < (MAX_BIT); ++j) {
      if (A[i] & (1LL << j)) {
        tmp += (ll)(N - i - 1 - bit[j]) * (1LL << j);
      } else {
        tmp += (ll)bit[j] * (1LL << j);
      }
      tmp %= MOD;
    }
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << "\n";
  return 0;
}
