#include <bits/stdc++.h>
using namespace std;
long long const m = 1000000007;
long long power(long long a, int n, int m) {
  if (n == 0)
    return 1;
  else if (n == 1)
    return a % m;
  else {
    long long res = power(a, n / 2, m);
    if (n % 2 == 0)
      return ((res) * (res)) % m;
    else
      return ((res) * (res) * (a)) % m;
  }
}
int main() {
  long long n, i, j = 0, k, count = 0, temp = 0, temp0 = 0, temp1 = 0;
  cin >> n;
  long long arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  while (arr[n - 1] > 0) {
    temp0 = 0, temp1 = 0;
    for (i = 0; i < n; i++) {
      if (arr[i] % 2 == 0)
        temp0++;
      else
        temp1++;
      arr[i] /= 2;
    }
    temp = (long long)(power(2, j, m)) * temp0 * temp1;
    count = (count + temp) % m;
    j++;
  }
  cout << count << "\n";
  return 0;
}
