#include<bits/stdc++.h>

using namespace std;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popb pop_back
#define popf pop_front
#define int long long int
#define vi         vector<int>
#define vll        vector<ll>
#define vpii       vector<pair<int,int>>
#define vpll       vector<pair<ll,ll>>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(container) int((container).size())
#define rep(i,a,b) for(i=a;i<b;i++)
#define tr(container,it)   for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define mod 998244353
#define fs first
#define sc second
signed main()
{
  fastio
//   freopen("INPUT.txt", "r", stdin);
//   freopen("OUTPUT.txt", "w", stdout);

  int n,i,j;
  cin>>n;
  int a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  int sum = 0; 
    for (i = 0; i < 61; i++)  
    { 
        int zc = 0, oc = 0;  
          int idsum = 0;  
        for (j = 0; j < n; j++) 
        { 
            if (a[j] % 2 == 0) 
                zc++; 
            else
                oc++; 
            a[j] /= 2; 
        } 
        idsum = ((oc * zc)%hell) * (((1 << i)%hell);   
		sum += idsum;  
		sum%=hell;
    } 
    cout<< sum; 
  return 0;
}