#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  int bits[61];
  for (int i = 0; i <= 60; i++) bits[i] = 0;
  for (int i = 0; i < N; i++) {
    long long A;
    cin >> A;
    int bit = 1;
    while (A) {
      if (A & 1) bits[bit] += (A & 1);
      bit += 1;
      A = A >> 1;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= 60; i++) {
    ans += pow(2, i - 1) * bits[i] * (N - bits[i]);
    if (ans > MOD) ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
