#include <bits/stdc++.h>
long long int a[600000];
int c[100000] = {0};
int d[100000] = {0};
int main() {
  long long int n, i, s, sum = 0, q, p, j, t;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (a[i] >= a[j]) {
        t = 0;
        s = a[i];
        while (s > 0) {
          d[t++] = s % 2;
          s /= 2;
        }
        s = a[j];
        for (q = 0; q < t; q++) {
          c[q] = s % 2;
          s /= 2;
        }
        p = 1;
        for (q = 0; q < t; q++) {
          if (d[q] == c[q])
            c[q] = 0;
          else
            c[q] = 1;
          sum += p * c[q];
          p *= 2;
          if (sum > 1000000007) sum = sum % (1000000007);
        }
      } else {
        t = 0;
        s = a[j];
        while (s > 0) {
          d[t++] = s % 2;
          s /= 2;
        }
        s = a[i];
        for (q = 0; q < t; q++) {
          c[q] = s % 2;
          s /= 2;
        }
        p = 1;
        for (q = 0; q < t; q++) {
          if (d[q] == c[q])
            c[q] = 0;
          else
            c[q] = 1;
          sum += p * c[q];
          p *= 2;
          if (sum > 1000000007) sum = sum % (1000000007);
        }
      }
    }
  }
  printf("%lld", sum);
}
