#include <bits/stdc++.h>
using namespace std;
unsigned long long int arr[500009];
unsigned long long int sumXOR(unsigned long long int n) {
  unsigned long long int sum1 = 0;
  for (unsigned long long int i = 0; i < 60; i++) {
    unsigned long long int zc = 0, oc = 0;
    unsigned long long int idsum = 0;
    for (unsigned long long int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0) {
        zc++;
      } else {
        oc++;
      }
      arr[j] /= 2;
    }
    idsum = (oc * zc * ((1ll << i) % 1000000007)) % 1000000007;
    sum1 = (sum1 + idsum) % 1000000007;
  }
  return sum1;
}
int main() {
  unsigned long long int sum = 0, n;
  cin >> n;
  for (unsigned long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sum = sumXOR(n);
  cout << sum << endl;
  return 0;
}
