#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int mod = 1000000007;

unsigned countBits(int number)
{      
    return (int)log2(number)+1;
}

int main() {
  int sum = 0;
  int n;
  cin>>n;
  int lst[n] = {};
  int maxLength = 0;
  for(int i = 0; i < n; i += 1) {
  	cin>>lst[i];
  	int l = countBits(lst[i]);
  	if (l > maxLength) maxLength = l;
  }
  
  int zlstmaxLength[maxLength] = {0};
  int olstmaxLength[maxLength] = {0};
  for(int i = 0; i < n; i += 1) {
    
    for(int j = 0; j < maxLength; j += 1) {
      if((lst[i]&(1u<<j)) == (1u<<j)) {
		olstmaxLength[j] += 1;
      }else {
		zlstmaxLength[j] += 1;
      }
    }
  }
  for(int i = 0; i < maxLength; i += 1) {
    //cout<<zlstmaxLength[i]<<" "<<olstmaxLength[i]<<endl;
    int k = (1u<<i);
    k = k * olstmaxLength[i] * zlstmaxLength[i];
    sum = (sum + k)%mod;
  }
  cout<<sum;
  return 0;
}