#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long posd[62];
  fill(posd, posd + 62, 0);
  for (int i = 0; i < n; i++) {
    long long b = a[i];
    for (int j = 0; j < 62 && b > 0; j++) {
      posd[j] += b % 2;
      b /= 2;
    }
  }
  long long power2[62];
  power2[0] = 1;
  for (int i = 1; i < 62; i++) {
    power2[i] = power2[i - 1] * 2;
  }
  for (int i = 0; i < 62; i++) {
    power2[i] %= mod;
  }
  long long ans = 0;
  for (int i = 0; i < 62; i++) {
    ans += posd[i] * (n - posd[i]) * power2[i];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
