#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const double PI = 3.14159265358979;
const ll INF = pow(10, 18);
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  ll s = 1, ans = 0;
  while (a[n - 1] != 0) {
    ll cntz = 0;
    ll cnto = 0;
    for (ll i = 0; i < n; i++) {
      if (a[i] % 2 == 0) {
        cntz++;
      } else {
        cnto++;
      }
      a[i] /= 2;
    }
    ans = (ans + s * cntz * cnto) % MOD;
    s = 2 * s % MOD;
  }
  cout << ans << endl;
}
