#include <bits/stdc++.h>
void merge_int(int *val, int lower, int sep, int upper, int *tmp_val) {
  int i_lower = lower;
  int i_upper = sep;
  int i_b = 0;
  while ((i_lower < sep) && (i_upper < upper)) {
    if (val[i_lower] < val[i_upper]) {
      tmp_val[i_b++] = val[i_lower++];
    } else {
      tmp_val[i_b++] = val[i_upper++];
    }
  }
  if (i_lower >= sep) {
    while (i_upper < upper) {
      tmp_val[i_b++] = val[i_upper++];
    }
  } else {
    while (i_lower < sep) {
      tmp_val[i_b++] = val[i_lower++];
    }
  }
  for (i_lower = 0; i_lower < i_b; i_lower++) {
    val[i_lower + lower] = tmp_val[i_lower];
  }
}
void merge_sort_int(int *val, int lower, int upper, int *tmp_val) {
  int sep;
  if ((lower == upper) || (lower + 1 == upper)) {
    return;
  }
  sep = (lower + upper) / 2;
  merge_sort_int(val, lower, sep, tmp_val);
  merge_sort_int(val, sep, upper, tmp_val);
  merge_int(val, lower, sep, upper, tmp_val);
  return;
}
void merge_int_int(int *val, int *index, int lower, int sep, int upper,
                   int *tmp_val, int *tmp_index) {
  int i_lower = lower;
  int i_upper = sep;
  int i_b = 0;
  while ((i_lower < sep) && (i_upper < upper)) {
    if (val[i_lower] < val[i_upper]) {
      tmp_val[i_b] = val[i_lower];
      tmp_index[i_b] = index[i_lower];
      i_b++;
      i_lower++;
    } else {
      tmp_val[i_b] = val[i_upper];
      tmp_index[i_b] = index[i_upper];
      i_b++;
      i_upper++;
    }
  }
  if (i_lower >= sep) {
    while (i_upper < upper) {
      tmp_val[i_b] = val[i_upper];
      tmp_index[i_b] = index[i_upper];
      i_b++;
      i_upper++;
    }
  } else {
    while (i_lower < sep) {
      tmp_val[i_b] = val[i_lower];
      tmp_index[i_b] = index[i_lower];
      i_b++;
      i_lower++;
    }
  }
  for (i_lower = 0; i_lower < i_b; i_lower++) {
    val[i_lower + lower] = tmp_val[i_lower];
    index[i_lower + lower] = tmp_index[i_lower];
  }
}
void merge_sort_int_int(int *val, int *index, int lower, int upper,
                        int *tmp_val, int *tmp_index) {
  int sep;
  if ((lower == upper) || (lower + 1 == upper)) {
    return;
  }
  sep = (lower + upper) / 2;
  merge_sort_int_int(val, index, lower, sep, tmp_val, tmp_index);
  merge_sort_int_int(val, index, sep, upper, tmp_val, tmp_index);
  merge_int_int(val, index, lower, sep, upper, tmp_val, tmp_index);
  return;
}
void merge_ll(long long *val, long long lower, long long sep, long long upper,
              long long *tmp_val) {
  long long i_lower = lower;
  long long i_upper = sep;
  long long i_b = 0;
  while ((i_lower < sep) && (i_upper < upper)) {
    if (val[i_lower] < val[i_upper]) {
      tmp_val[i_b++] = val[i_lower++];
    } else {
      tmp_val[i_b++] = val[i_upper++];
    }
  }
  if (i_lower >= sep) {
    while (i_upper < upper) {
      tmp_val[i_b++] = val[i_upper++];
    }
  } else {
    while (i_lower < sep) {
      tmp_val[i_b++] = val[i_lower++];
    }
  }
  for (i_lower = 0; i_lower < i_b; i_lower++) {
    val[i_lower + lower] = tmp_val[i_lower];
  }
}
void merge_sort_ll(long long *val, long long lower, long long upper,
                   long long *tmp_val) {
  long long sep;
  if ((lower == upper) || (lower + 1 == upper)) {
    return;
  }
  sep = (lower + upper) / 2;
  merge_sort_ll(val, lower, sep, tmp_val);
  merge_sort_ll(val, sep, upper, tmp_val);
  merge_ll(val, lower, sep, upper, tmp_val);
  return;
}
void merge_ll_ll(long long *val, long long *index, long long lower,
                 long long sep, long long upper, long long *tmp_val,
                 long long *tmp_index) {
  long long i_lower = lower;
  long long i_upper = sep;
  long long i_b = 0;
  while ((i_lower < sep) && (i_upper < upper)) {
    if (val[i_lower] < val[i_upper]) {
      tmp_val[i_b] = val[i_lower];
      tmp_index[i_b] = index[i_lower];
      i_b++;
      i_lower++;
    } else {
      tmp_val[i_b] = val[i_upper];
      tmp_index[i_b] = index[i_upper];
      i_b++;
      i_upper++;
    }
  }
  if (i_lower >= sep) {
    while (i_upper < upper) {
      tmp_val[i_b] = val[i_upper];
      tmp_index[i_b] = index[i_upper];
      i_b++;
      i_upper++;
    }
  } else {
    while (i_lower < sep) {
      tmp_val[i_b] = val[i_lower];
      tmp_index[i_b] = index[i_lower];
      i_b++;
      i_lower++;
    }
  }
  for (i_lower = 0; i_lower < i_b; i_lower++) {
    val[i_lower + lower] = tmp_val[i_lower];
    index[i_lower + lower] = tmp_index[i_lower];
  }
}
void merge_sort_ll_ll(long long *val, long long *index, long long lower,
                      long long upper, long long *tmp_val,
                      long long *tmp_index) {
  long long sep;
  if ((lower == upper) || (lower + 1 == upper)) {
    return;
  }
  sep = (lower + upper) / 2;
  merge_sort_ll_ll(val, index, lower, sep, tmp_val, tmp_index);
  merge_sort_ll_ll(val, index, sep, upper, tmp_val, tmp_index);
  merge_ll_ll(val, index, lower, sep, upper, tmp_val, tmp_index);
  return;
}
int main(int argc, char **argv) {
  int n;
  long long a[300000];
  long long sum = 0;
  fscanf(stdin, "%d", &(n)) > 0;
  {
    int i;
    for ((i) = (0); (i) < (n); (i)++) {
      fscanf(stdin, "%lld", &(a[i])) > 0;
    }
  }
  {
    int i;
    for ((i) = (0); (i) < (n - 1); (i)++) {
      int j;
      for ((j) = (i + 1); (j) < (n); (j)++) {
        sum += a[i] ^ a[j];
        sum %= 1000000007;
      }
    }
  }
  fprintf(stdout, "%lld\n", (sum));
  return 0;
}
