#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  vector<long long> v(N);
  for (long long i = 0; i < N; i++) {
    scanf("%lld", &v[i]);
  }
  long long ans = 0;
  vector<long long> n_digit(61, 0);
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 61; j++) {
      if (v[i] & (1ll << j)) {
        n_digit[j]++;
      }
    }
  }
  for (long long i = 0; i < 61; i++) {
    long long sum = (N - n_digit[i]) * n_digit[i];
    sum %= (long long)1e9 + 7;
    ans += sum * (1ll << i);
    ans %= (long long)1e9 + 7;
  }
  cout << ans << endl;
}
