#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;
  int mod = 1e9 + 7;
  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)) % mod) * bi) % mod) % mod;
    bi = (bi * 2) % mod;
  }
  cout << sum % mod << endl;
  return 0;
}
