#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  long long res = 0;
  int d = 1;
  while (true) {
    vector<long long> b(n);
    for (int i = 0; i < (n); ++i) b[i] = a[i] & 1;
    int n0 = 0, n1 = 0;
    for (int i = 0; i < (n); ++i) {
      if (b[i] == 0)
        n0++;
      else
        n1++;
    }
    res = res + (d * (n0 * n1 % MOD) % MOD) % MOD;
    bool notzero = false;
    for (int i = 0; i < (n); ++i) {
      a[i] >>= 1;
      if (a[i] > 0) notzero = true;
    }
    if (!notzero) break;
    d = 2 * d % MOD;
  }
  cout << res << endl;
  return 0;
}
