#include <bits/stdc++.h>
using namespace std;
long long arr[1000000];
long long add(long long a, long long b) {
  long long x_or = a ^ b;
  long long a_nd = a & b;
  a_nd = a_nd << 1;
  while ((a_nd & x_or) != 0) {
    long long txor = a_nd ^ x_or;
    long long tand = a_nd & x_or;
    long long uand = tand << 1;
    a_nd = uand;
    x_or = txor;
  }
  return x_or ^ a_nd;
}
long long subside(long long a, long long b) {
  long long first = a ^ b;
  long long second = a ^ (a | b);
  first = first ^ second;
  return add(first, add((~second), 1));
}
long long divide(long long a, long long b) {
  bool a_is_minus = false;
  bool b_is_minus = false;
  if (a < 0) {
    a_is_minus = true;
    a = ~subside(a, 1);
  }
  if (b < 0) {
    b_is_minus = true;
    b = ~subside(b, 1);
  }
  long long plusObj = b;
  long long plusNum = 1;
  while (add(plusObj, b) <= a) {
    plusObj = add(plusObj, b);
    plusNum = add(plusNum, 1);
  }
  if (a_is_minus ^ b_is_minus) plusNum = add(~plusNum, 1);
  return plusNum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  int N;
  long long answer = 0;
  long long div = (long long)pow(10, 9) + (long long)7;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> arr[i];
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      answer = add(answer, (arr[i] ^ arr[j]));
      answer %= div;
    }
  }
  cout << answer << endl;
  return 0;
}
