#include<vector>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdint>
#define MOD 1000000007
#define ll long long
using namespace std;

int main() {
 vector<int> lists(61);
 for (int i = 0; i < 61; i++) {
  lists.at(i) = 0;
 }
 
 ll N;
 cin >> N;

 for (int i = 0; i < N; i++) {
  ll p_two, temp;
  cin >> temp;

  for (int j = 0; j < 61; j++) {
   p_two = pow(2, j);  
   if ((temp & p_two) !=  0) {
    lists.at(j) += 1;
   }
  }
 }

 ll ans = 0;

 for (int i = 0; i < 61; i++) {
  ans += pow(2, i) * lists[i] * (N - lists[i]);
  ans %= MOD;
 }

 cout << ans << endl;
}