#include <bits/stdc++.h>
using namespace std;
int binaryNum[62];
void decToBinary(long long n) {
  for (long long i = (0); i < (long long)(62); i++) binaryNum[i] = 0;
  int i = 0;
  while (n > 0) {
    binaryNum[i] = n % 2;
    n = n / 2;
    i++;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  long long cuantos[62];
  for (long long i = (0); i < (long long)(62); i++) cuantos[i] = 0;
  long long x;
  cin >> n;
  for (long long i = (0); i < (long long)(n); i++) {
    cin >> x;
    decToBinary(x);
    for (long long i = (0); i < (long long)(62); i++)
      cuantos[i] += long long(binaryNum[i]);
  }
  long long resp = 0, prod, pot = 1;
  for (long long i = (0); i < (long long)(62); i++) {
    prod = (((cuantos[i] * (n - cuantos[i])) % 1000000007) * pot) % 1000000007;
    resp = (resp + prod) % 1000000007;
    pot *= 2;
  }
  cout << resp << endl;
  return 0;
}
