#include <bits/stdc++.h>
using namespace std;
int main() {
  long long MOD = 1000000000 + 7;
  int N;
  cin >> N;
  long long A;
  int b[60] = {};
  for (int i = 0; i < N; i++) {
    cin >> A;
    for (int j = 0; j < 60; j++) {
      b[j] += A % 2;
      A /= 2;
    }
  }
  long long answer = 0;
  long long d = 1;
  for (int i = 0; i < 60; i++) {
    answer += b[i] * (N - b[i]) * d;
    d *= 2;
    d %= MOD;
    answer %= MOD;
  }
  cout << answer << endl;
}
