#include <bits/stdc++.h>
using namespace std;
long long dp[300005];
vector<long long> g_data;
int n;
long long calc(int idx) {
  if (dp[idx] >= 0) return dp[idx];
  long long ans = 0;
  for (int i = idx + 1; i < n; ++i) {
    ans += (g_data[idx] ^ g_data[i]);
  }
  ans %= 1000000007;
  dp[idx] = ans;
  return ans;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    long long tmp;
    cin >> tmp;
    g_data.push_back(tmp);
  }
  long long ans = 0;
  for (int i = 0; i < (n - 1); ++i) {
    ans += calc(i);
  }
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
