#include <iostream>
#include <string>
#define REP(i,n) for(int i=0;i<(n);++i)
#define MOD 1000000007
using namespace std;
typedef long long int LL;


int main(){
  int N;
  cin >> N;
  int k[63] = {};
  REP(i, N){
    LL A;
    cin >> A;
    for(int i = 0;A != 0; ++i) {
      if((A & 1) != 0) { k[i]++; }
      A = A >> 1;
    }
  }
  LL ret = 0;
  REP(i, 63) {
    LL m = (1LL << i) % MOD;
    LL c = k[i] * (N - k[i]) % MOD
    ret += m * c;
    ret = ret % MOD;
  }
  cout << ret << endl;
}