#include <bits/stdc++.h>
using namespace std;
void compbin(int* bin, int a) {
  int i = 0;
  while (a != 0) {
    if (a % 2 == 1) {
      bin[i] = 1;
    }
    a = floor(a / 2);
    i++;
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int result = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 1; j < n; j++) {
      int binA[61];
      int binB[61];
      for (int ii = 0; ii < 61; ii++) {
        binA[ii] = 0;
        binB[ii] = 0;
      }
      compbin(binA, a[i]);
      compbin(binB, a[j]);
      int xorr = 0;
      for (int k = 0; k < 61; k++) {
        if (binA[k] != binB[k]) {
          xorr += pow(10, k);
        }
      }
      result += xorr;
    }
  }
  cout << result / (pow(10, 9) + 7) << endl;
}
