#include <bits/stdc++.h>
using namespace std;
long long mod = pow(10, 9) + 7;
int main() {
  int N;
  cin >> N;
  vector<long long> A(300010);
  vector<long long> x(100, 0), y(100, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    int j = 0;
    while (A[i] > 0) {
      if (A[i] % 2 == 0) {
        x[j]++;
      } else {
        y[j]++;
      }
      A[i] /= 2;
      j++;
    }
  }
  long long ans = 0;
  for (int k = 0; k < 60; k++) {
    ans = (ans +
           (((1 << k) % mod) * ((long long)(N - y[k]) * y[k]) % mod) % mod) %
          mod;
  }
  cout << ans << endl;
  return 0;
}
