#include <bits/stdc++.h>
struct Fast {
  Fast() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
  }
} fast;
using namespace std;
long long mod = 1e9 + 7;
inline long long gcd(long long a, long long b) {
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
inline long long lcm(long long x, long long y) {
  if (x == 0 || y == 0) {
    return -1;
  }
  return (x * y / gcd(x, y));
}
inline 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;
}
inline long long nCr(long long n, long long r) {
  if (r * 2 > n) r = n - r;
  long long dividend = 1;
  long long divisor = 1;
  for (long long i = 1; i <= r; ++i) {
    dividend *= (n - i + 1);
    divisor *= i;
  }
  return (dividend / divisor);
}
inline vector<pair<long long, int>> factorize(long long n) {
  vector<pair<long long, int>> res;
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i) continue;
    res.emplace_back(i, 0);
    while (n % i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n, 1);
  return res;
}
inline 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;
  }
}
inline long long factorialMethod(long long k) {
  long long sum = 1;
  for (int i = 1; i <= k; ++i) {
    sum *= i;
  }
  return sum;
}
inline long long vector_finder(std::vector<long long> vec, long long number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance(vec.begin(), itr);
  if (index != vec.size()) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (int)(n); i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i < (int)(n - 1); i++) {
    if (a[i] == 1) {
      for (long long j = i + 1; j < n; j++) {
        if (a[j] % 2 == 0) {
          ans += a[j] + 1;
        } else {
          ans += a[j] - 1;
        }
      }
      continue;
    }
    for (long long j = i + 1; j < n; j++) {
      if (a[j] == 1) {
        if (a[i] % 2 == 0) {
          ans += a[i] + 1;
        } else {
          ans += a[i] - 1;
        }
        continue;
      }
      if (a[i] != a[j]) {
        ans += a[i] ^ a[j];
      }
    }
  }
  cout << ans % mod << endl;
  return 0;
}
