#include <bits/stdc++.h>
using namespace std;
const long long Mod = (long long)(1e9) + 7;
int main() {
  long long a;
  int N, i, j;
  int A[60][2] = {};
  long long x[60] = {};
  cin >> N;
  i = 0;
  while (cin >> a) {
    for (j = 0; j < 60; a >>= 1, j++) {
      A[j][a & 1] += 1;
    }
    i++;
    if (i >= N) {
      break;
    }
  }
  for (int i = 0; i < 60; i++) {
    x[i] = A[i][0] * A[i][1];
  }
  long long y = 0;
  for (int i = 0; i < 60; i++) {
    y += (x[i] * ((1LL << i)) % Mod);
    y %= Mod;
  }
  cout << y << endl;
  return 0;
}
