#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  long long n, i, j, x, ans = 0LL;
  cin >> n;
  vector<long long> a(n);
  for (i = 0; i < n; i++) cin >> a.at(i);
  for (i = 0; i < 60; i++) {
    x = 0LL;
    for (j = 0; j < n; j++) {
      if (((a.at(j) % (long long)pow(2LL, i + 1)) / (long long)pow(2LL, i)) ==
          1)
        x++;
    }
    x *= (n - x);
    for (j = 0; j < i; j++) x = (x * 2) % mod;
    ans += x;
    ans %= mod;
  }
  cout << (ans % mod) << endl;
}
