#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < int(n); ++i) cin >> a[i];
  ll sum = 0;
  ll mod = 1e9 + 7;
  for (int i = 0; i < int(64); ++i) {
    ll z = 0, o = 0;
    ll bitsum = 0;
    for (int j = 0; j < int(n); ++j) {
      if (a[j] % 2 == 0)
        z++;
      else
        o++;
      a[j] /= 2;
    }
    bitsum = (1LL << i);
    bitsum %= mod;
    bitsum *= z * o;
    bitsum %= mod;
    sum += bitsum;
    sum %= mod;
  }
  cout << sum << endl;
}
