#include <bits/stdc++.h>
using namespace std;
typedef  long long unsigned ull;
constexpr long long mod = 1000000007;
ull n, a[300000],d[60][2];

int main(){
cin>>n;
for (ull i=0; i<n; i++){
  cin>>a[i];
  for (ull j=0; j<60; j++){
    //d[j][(a[i] & ((ull) 1 << j)) ? 1 : 0]++;
    d[j][(a[i]&((ull) 1<<j)) ?1:0]++;


  }
}
for (ull i = 0; i < 60; i++) r[i] = (d[i][0] * d[i][1]) % mod;
p[0] = 1;
for (ull i = 1; i < 60; i++) p[i] = (p[i - 1] * 2) % mod;
for (ull i = 0; i < 60; i++) s = (s + r[i] * p[i]) % mod;
cout << s << endl;
}

cout<<ans;
}
