#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, b[300000][70], c, d[70] = {}, e = 0;
  cin >> n;
  for (long int i = 0; i < n; i++) {
    cin >> a;
    c = 2;
    for (int j = 0; j < 70; j++) {
      b[i][j] = a % c / (c / 2);
      a -= b[i][j];
      c *= 2;
    }
  }
  c = 1;
  for (long int i = 0; i < 70; i++) {
    for (int j = 0; j < n; j++) {
      if (b[j][i] == 1) d[i]++;
    }
    e += d[i] * (n - d[i]) * c;
    c *= 2;
  }
  cout << e % 1000000007 << endl;
}
