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