#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  long long a[n];
  long long c[62];
  long long ans[62];
  memset(c, 0, sizeof(c));
  memset(ans, 0, sizeof(ans));
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    long long k = a[i];
    int j = 0;
    while (k) {
      c[j] += k % 2;
      k /= 2;
      j++;
    }
  }
  long long ha;
  for (int i = 0; i < n; i++) {
    ha = a[i];
    for (int j = 0; j < 62; j++) {
      c[j] -= ha % 2;
      if (ha % 2 == 1) {
        ans[j] += n - i - 1 - c[j];
      } else {
        ans[j] += c[j];
      }
      ha /= 2;
    }
  }
  long long z = 0, yo;
  for (int i = 0; i < 62; i++) {
    yo = (pow(2, i));
    yo %= mod;
    yo *= ans[i];
    yo %= mod;
    z += yo;
    z %= mod;
  }
  cout << z;
  return 0;
}
