#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, k, count0 = 0, count1 = 0, base = 1, kotae = 0;
  cin >> n;
  bool a[n][60];
  for (i = 0; i < n; i++) {
    for (j = 0; j < 60; j++) {
      a[i][j] = 0;
    }
  }
  for (i = 0; i < n; i++) {
    cin >> k;
    for (j = 0; k > 0; j++) {
      a[i][j] = k % 2;
      k /= 2;
    }
  }
  for (i = 0; i < 60; i++) {
    count0 = 0;
    count1 = 0;
    for (j = 0; j < n; j++) {
      if (a[j][i] == 0) {
        count0++;
      } else {
        count1++;
      }
    }
    kotae = (kotae + count0 * count1 * base) % 1000000007;
    base *= 2;
  }
  cout << kotae;
}
