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