#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod 1000000007
#define mod2 998244353
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector <vector <int>>
#define v4096 vector <vector <lli>>
#define vt vector
#define true 1
#define false 0
#define f(x, y, z) for (int x = y; x < z; x++)
#define fd(x, y, z) for (int x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli,lli>
#define m32 map<int,int>
#define m64it map<lli,lli>::iterator
#define m32it map<int,int>::iterator
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ist insert
#define pi (ld)3.1415926535897
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace __gnu_pbds;
using namespace std;
lli tmod(lli x,lli m){return (x%m+m)%m;}
lli bit_cnt[60];
int main()
{
  fastio;
  int n;cin>>n;
  lli a[n];
  f(i,0,n)cin>>a[i];
  f(i,0,n){
    f(j,0,60){
      if((((1ll)<<j)&a[i]))
        bit_cnt[j]++;
    }
  }
  lli ans=0;
  f(i,0,60){  
    ans=(ans+((((1ll)<<i))%mod)*((bit_cnt[i])*(n-bit_cnt[i]))%mod)%mod;
  }
  cout<<tmod(ans,mod)<<"\n";
  return 0;    	
}