#include <bits/stdc++.h>
using namespace std;
long long num[61];
int main(void) {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    for (long long j = 0; j < 61; j++) {
      if (a[i] & (1LL << j)) {
        num[j]++;
      }
    }
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    long long calc = 1;
    for (long long j = 0; j < 61; j++) {
      if (a[i] & (1LL << j)) {
        sum += calc * (n - num[j]) % 1000000007;
      } else {
        sum += calc * num[j] % 1000000007;
      }
      sum %= 1000000007;
      calc *= 2;
      calc %= 1000000007;
    }
  }
  cout << sum / 2 << endl;
  return 0;
}
