#include <bits/stdc++.h>
using namespace std;
long long inf = 10e17;
long long maxProductSubarrayOfSizeK(long long A[], long long n, long long k) {
  sort(A, A + n);
  long long product = 1;
  if (A[n - 1] == 0 && (k & 1)) return 0;
  if (A[n - 1] <= 0 && (k & 1)) {
    for (long long i = n - 1; i >= n - k; i--) product *= A[i];
    return product;
  }
  long long i = 0;
  long long j = n - 1;
  if (k & 1) {
    product *= A[j];
    j--;
    k--;
  }
  k >>= 1;
  for (long long itr = 0; itr < k; itr++) {
    long long left_product = A[i] * A[i + 1];
    long long right_product = A[j] * A[j - 1];
    if (left_product > right_product) {
      product *= left_product;
      i += 2;
    } else {
      product *= right_product;
      j -= 2;
    }
  }
  return product;
}
int32_t main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<long long> vec;
  long long carry = 0;
  for (long long i = 0; i < 61; i++) {
    long long one = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] & 1) one++;
      arr[j] /= 2;
    }
    long long p = one * (n - one);
    long long sum = carry + p;
    vec.push_back(sum % 2);
    carry = sum / 2;
  }
  long long ans = 0;
  long long sum = 1;
  for (long long i = 0; i < vec.size(); i++) {
    ans = (ans + vec[i] * sum) % 1000000007;
    sum *= 2;
  }
  cout << ans << "\n";
  return 0;
}
