#include <bits/stdc++.h>
using namespace std;
long long int sumXOR(long long int arr[], int n) {
  long long int sum = 0;
  for (long long int i = 0; i < 62; i++) {
    long long int zc = 0;
    long long int oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = ((oc * zc) % (1000000000 + 7)) * ((long long int)pow(2, i)) %
            (1000000000 + 7);
    sum =
        (sum % (1000000000 + 7) + idsum % (1000000000 + 7)) % (1000000000 + 7);
  }
  return sum;
}
int main() {
  long long int sum = 0;
  int n;
  cin >> n;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sum = sumXOR(arr, n);
  cout << (sum);
  return 0;
}
