#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
long long app(long long arr[], long long n) {
  long long sum = 0;
  for (long long i = 0; i < 61; i++) {
    long long zc = 0, oc = 0;
    long long adsum = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0) {
        zc++;
      } else {
        oc++;
      }
      arr[j] = arr[j] / 2;
    }
    adsum = (((oc * zc) % mod) * ((1 << i) % mod)) % mod;
    sum = sum + adsum;
    sum = sum % mod;
  }
  return sum;
}
int32_t main() {
  long long n;
  cin >> n;
  long long arr[n];
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sum = app(arr, n);
  cout << sum << endl;
  return 0;
}
