#include <bits/stdc++.h>
using namespace std;
long long get() {
  long long r;
  cin >> r;
  return r;
}
long long n, a[123456];
signed main() {
  cin >> n;
  long long ans = 0, p = 1;
  for (long long i = 1; i <= (n); i++) cin >> a[i];
  bool b;
  do {
    b = 0;
    long long a0 = 0, a1 = 0;
    for (long long i = 1; i <= (n); i++) {
      if (a[i] % 2)
        a1++;
      else
        a0++;
      a[i] /= 2;
      if (a[i] > 0) b = 1;
    }
    ans += (a0 * a1) * p % 1000000007;
    ans %= 1000000007;
    p *= 2;
    p %= 1000000007;
  } while (b);
  cout << ans << endl;
}
