#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[64] = {0};
  long long given[n];
  for (long long i = 0; i < n; i++) cin >> given[i];
  for (long long i = 0; i < 64; i++) {
    for (long long j = 0; j < n; j++) {
      if (given[j] & 1) arr[i]++;
      if (given[j] > 0) given[j] >>= 1;
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 64; i++) {
    ans += ((n - arr[i]) * arr[i] * pow(2, i));
    ans = ans % 1000000007;
  }
  cout << ans % 1000000007 << endl;
}
