#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define MOD (1e9 + 7)
int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n){
    cin >> a[i];
  }
  vector<vector<ll>> c(63, vector<ll>(2));
  ll ans = 0;
  REP(i, n){
    REP(j, 63){
      ll f = (a[i] >> j) & 1LL;
      ans += c[j][f ^ 1] * (1LL << j);
      c[j][f]++;
      ans %= MOD;
     }
  }
  cout << ans << endl;
}