#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll Max(ll(a), ll(b), ll(c)) { return max(max(a, b), c); }
ll Min(ll(a), ll(b), ll(c)) { return min(min(a, b), c); }
ll mod = 1e9 + 7;
ll A0[62];
ll A1[62];
int main() {
  ll N;
  cin >> N;
  for (long long i = 0; i < (long long)(N); i++) {
    ll t;
    cin >> t;
    for (long long j = 0; j < (long long)(62); j++) {
      if (t % 2 == 0)
        A0[j]++;
      else
        A1[j]++;
      t /= 2;
    }
  }
  ll an = 0;
  ll k = 1;
  for (long long j = 0; j < (long long)(62); j++) {
    an += ((A0[j] * A1[j]) * k) % mod;
    k *= 2;
    k %= mod;
  }
  cout << an % mod << endl;
}
