#include <bits/stdc++.h>
long long calc(long long a, long long b, long long p) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    long long d = calc(a, b / 2, p);
    return (d * d) % p;
  } else {
    return (a * calc(a, b - 1, p)) % p;
  }
}
void swap(long long x, long long y) {
  long long tmp = 0;
  tmp = x;
  x = y;
  y = tmp;
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
  printf("ddd\n");
}
long long fac[1000005], finv[1000005], inv[1000005];
void COMinit() {
  fac[0] = 1;
  fac[1] = 1;
  finv[0] = 1;
  finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 1000005; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % 1000000007) % 1000000007;
}
int compare_int(const void *a, const void *b) {
  return *(long int *)b - *(long int *)a;
}
int compare_int_small(const void *a, const void *b) {
  return *(long int *)a - *(long int *)b;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
typedef struct pp {
  char c;
  int h;
  int w;
} P;
int top = 0;
P *Stack = NULL;
P *tmp = NULL;
void initialize() {
  Stack = (P *)calloc(100002, sizeof(P));
  top = 0;
}
void finalize() {
  if (Stack != NULL) {
    free(Stack);
    Stack = NULL;
  }
}
int isEmpty() {
  if (top <= 0) {
    return 1;
  } else {
    return 0;
  }
}
int isFull() {
  if (top > 100002 - 1) {
    return 1;
  } else {
    return 0;
  }
}
int push(P x) {
  fprintf(stderr, "pushするのは%c (h, w) = (%d, %d)\n", x.c, x.h, x.w);
  if (isFull() != 0) {
    printf("Error! Overfllow\n");
    return 0;
  } else {
    top++;
    if (Stack != NULL) {
      Stack[top] = x;
    }
    return 0;
  }
}
P pop() {
  if (isEmpty() != 0) {
    printf("Error! Underfllow\n");
    return *tmp;
  } else {
    top--;
    return Stack[top + 1];
  }
}
int a[21];
int n = 0;
int solve(int i, int m) {
  int res = 0;
  if (m == 0) {
    return 1;
  }
  if (i >= n) {
    return 0;
  }
  if (solve(i + 1, m) != 0) {
    res = solve(i + 1, m);
  } else if (solve(i + 1, m - a[i]) != 0) {
    res = solve(i + 1, m - a[i]);
  }
  return res;
}
int main(void) {
  long long int n = 0;
  long long int ans = 0;
  long long int a[300001];
  scanf("%lld", &n);
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (long long int i = 0; i < n - 1; i++) {
    for (long long int j = i + 1; j < n; j++) {
      ans += a[i] ^ a[j];
      if (ans > 1000000007) {
        ans %= 1000000007;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
