#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <vector>
using namespace std;
#define INF 1000000007
#define ll long long
#define rep(i_, __start, __end) for(ll i_=(ll)__start; i_<(ll)__end; i_++)
#define print(_a) cout << _a << endl;
#define printarray(a, len) rep(ii,0,len) cout << a[ii] << " ";
#define printarray2(aa, len) rep(ij,0,len) printarray(aa[ij], aa[ij].size()); print("");

ll dp[62] = {};
int main(){
    ll n, a, cur=1, ans=0;
    cin >> n;
    rep(i, 0, n){
      cin >> a;
      rep(x, 0, 62){
        if(a % 2 == 1) dp[x] += 1;
        a /= 2;
      }
    }
    
    rep(i, 0, 62){
      t = cur;
      t *= dp[i];
      t %= INF;
      t *= (n - dp[i]);
      t %= INF;
      cur *= 2;
      cur %= INF;
      ans %= INF;
    }

    print(ans);

  return 0;
}