#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int64_t a[N];
  int64_t sum = 0;
  int i;
  int j;
  int64_t bi = 1;
  for (i = 0; i < N; ++i) {
    cin >> a[i];
  }
  for (i = 0; i < 61; ++i) {
    int count = 0;
    for (j = 0; j < N; ++j) {
      count += a[j] % 2;
      a[j] /= 2;
    }
    sum = sum + (count * (N - count) * bi) % 1000000007;
    bi = bi * 2 % 1000000007;
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
