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