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