#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
unsigned long long sumXOR(unsigned long long arr[], int n) {
  unsigned long long sum = 0;
  for (unsigned long long i = 0; i < (64); i++) {
    unsigned long long zero_cnt = 0, one_cnt = 0;
    unsigned long long idsum = 0;
    for (unsigned long long j = 0; j < (n); j++) {
      if (arr[j] & 1)
        one_cnt++;
      else
        zero_cnt++;
      arr[j] >>= 1;
    }
    idsum = (one_cnt * zero_cnt * ((1LL << i) % mod)) % mod;
    sum += idsum % mod;
    sum %= mod;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;
  unsigned long long a[300000];
  for (unsigned long long i = 0; i < (n); i++) {
    cin >> a[i];
  }
  cout << sumXOR(a, n) % mod;
  return 0;
}
