#include <bits/stdc++.h>
using namespace std;
long long int n, m, i, j, k, l, t, arr[300009], crr[200009] = {}, x, y, z;
int main() {
  k = 0;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) scanf("%lld", &arr[i]);
  for (i = 0; i < n; i++) {
    m = arr[i];
    l = 1;
    while (m) {
      j = m % 2;
      crr[l] += j;
      l++;
      m /= 2;
    }
    z = max(z, l);
  }
  t = 1000000007;
  m = 0;
  for (i = 1; i < z; i++) {
    l = n - crr[i];
    if (l > 0) l = l % t;
    l *= crr[i];
    if (l > 0) {
      l = l % t;
      x = 1;
      y = 1;
      while (y < i) {
        x *= 2;
        y++;
      }
      l *= x;
      l = l % t;
      if (m > 0) m = m % t;
      m += l;
      if (m > 0) m = m % t;
    }
  }
  printf("%lld", m);
}
