#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
void nisin(auto n,vector<int> &B){
  int i=0;
  while(n>0){
    B[i]=n%2;
    n=n/2;
    i++;
  }
}
int Xor(vector<int> C,vector<int> D){
  unsigned long long count=0;
  unsigned long long ask=1;
  rep(i,64){
    if(C[i]!=D[i]){
      count+=ask;
      count=count%1000000007;
    }
    ask=ask*2;
  }
  return count;
}
int main() {
  unsigned long long count=0;
  int N;
  cin>>N;
  vector<vector<int>>A(N,vector<int>(64));
  rep(i,N){
    unsigned long long n;
    cin>>n;
    nisin(n,A[i]);
  }
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      count+=Xor(A[i],A[j]);
      count=count%1000000007;
    }
  }
  cout<<count;
}