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