#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
struct z_o {
  long long int zero_num;
  long long int one_num;
};
int main() {
  int N;
  cin >> N;
  vector<long long int> A(N);
  vector<z_o> count;
  z_o init = {0, 0};
  count.assign(60, init);
  for (int n = 0; n < N; n++) {
    cin >> A[n];
    for (int i = 0; i < 60; i++) {
      if (A[n] & ((long long int)1 << i)) {
        count[i].one_num++;
      } else {
        count[i].zero_num++;
      }
    }
  }
  for (int i = 0; i < 60; i++) {
  }
  long long int ans = 0;
  for (int n = 0; n < N; n++) {
    for (int i = 0; i < 60; i++) {
      if (A[n] & ((long long int)1 << i)) {
        ans += (count[i].zero_num * ((long long int)1 << i)) % MOD;
        ans %= MOD;
      } else {
        ans += (count[i].one_num * ((long long int)1 << i)) % MOD;
        ans %= MOD;
      }
    }
  }
  if (ans % 2 != 0) {
    ans += MOD;
  }
  cout << ans / 2 << endl;
  return 0;
}
