#include <bits/stdc++.h>

using namespace std;

#define loop(i,n) for(i=0;i<n;i++)
typedef long long ll;
ll const m =1000000007;
 


int main()
{
 ll n,i,j=0,k,count=0,temp=0,temp0=0,temp1=0;
  cin>>n;
  ll arr[n];
  
for(i=0;i<n;i++) cin>>arr[i];

sort(arr,arr+n);

while(arr[n-1]>0)
{
  temp0=0,temp1=0;
for(i=0;i<n;i++)
{
  if(arr[i]%2==0)temp0++;
  else temp1++;

  arr[i]/=2;
}
    temp=(ll)(pow(2,j)%m)*temp0*temp1;
    count=(count+temp)%m;
    j++;
}

cout<<count<<"\n";


return 0;
}
     


    

    
