#include <bits/stdc++.h>
using namespace std;
using Int = long long;
Int inf = 1000000000000000001LL;
using vi = vector<Int>;
using vvi = vector<vi>;
using mapis = unordered_map<Int, string>;
using mapii = unordered_map<Int, Int>;
using pii = pair<Int, Int>;
Int GCD(Int a, Int b) {
  if (b == 0) return a;
  if (a < b) return GCD(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}
Int modinv(Int a, Int 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;
}
Int binary_search_index(Int Y, vi &q) {
  int left = 0, right = q.size() - 1;
  while (right >= left) {
    int mid = left + (right - left) / 2;
    if (q[mid] == Y)
      return mid;
    else if (q[mid] > Y)
      right = mid - 1;
    else if (q[mid] < Y)
      left = mid + 1;
  }
  return -1;
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}
int root_sum(int target, vi &parents, vi &nodes_value, vi &memo, int sum) {
  if (memo[target] != -1) {
    sum += memo[target];
    return sum;
  }
  if (parents[target] == target) {
    sum += nodes_value[target];
    return sum;
  } else {
    sum += nodes_value[target];
    return root_sum(parents[target], parents, nodes_value, memo, sum);
  }
}
bool is_prime(Int n, map<Int, Int> &memo) {
  if (memo[n] == 1) {
    return false;
  } else if (memo[n] == 2) {
    return true;
  }
  bool prime = true;
  for (Int i = 2; i <= sqrt(n) + 2; i++) {
    if (memo[i] == 2 && n % i == 0) {
      prime = false;
    }
  }
  if (prime) {
    memo[n] = 2;
  } else {
    memo[n] = 1;
  }
  return prime;
}
int main() {
  Int N;
  cin >> N;
  Int mod = 1000000000 + 7;
  vi nums = vi(N);
  for (Int i = 0; i < Int(N); i++) {
    cin >> nums[i];
  }
  int ans = 0;
  for (Int i = 0; i < Int(N - 1); i++) {
    for (Int j = i + 1; j < Int(N); j++) {
      ans += (nums[i] ^ nums[j]) % mod;
      ans = ans % mod;
    }
  }
  cout << ans << endl;
  return 0;
}
