#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(60);
  for (long long i = 0; i < N; i++) {
    long long a;
    cin >> a;
    for (long long j = 0; j < 60; j++)
      if (a & (1 << j)) A[j]++;
  }
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    ans += A[i] * (N - A[i]);
    ans %= 1000000007;
  }
  cout << ans << endl;
}
