#include <bits/stdc++.h>
using namespace std;
long long ch[60];
int main() {
  long long n;
  cin >> n;
  long long cnt = n * (n - 1) / 2;
  for (long long i = 0; i < n; i++) {
    long long now;
    cin >> now;
    for (long long j = 0; j < 60; j++) {
      ch[j] += (now % 2);
      now /= 2;
    }
  }
  long long ans = 0, kei = 1;
  for (long long i = 0; i < 60; i++) {
    ans += kei * (cnt - (ch[i]) * (ch[i] - 1) / 2 -
                  (n - ch[i]) * (n - ch[i] - 1) / 2);
    ans %= 1000000007;
    kei *= 2;
  }
  cout << ans;
  return 0;
}
