#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9 + 7;

int main() {
  		int N; cin >> N;
  		ll A[N];	
  		for (int i = 0; i < N; i++) cin >> A[i];
  		ll ans = 0;
  		for (int bit = 0; bit < 62; bit++) {
          		ll ones = 0, zeros = 0;
          		for (int j = 0; j < N; j++) {
                  		if (A[j] >> bit & 1) ones++;
                  		else zeros++;
                }
          		ll mult = (p * q) % mod;
          		for (int j = 0; j < bit; j++) {
                  	mult = (mult * 2)% mod;
                }
          		ans += mult;
          		ans %= mod;
        }
  		cout << ans << endl;
  		return 0;
}