#include <bits/stdc++.h>
using namespace std;
static const int mod = 1000000007;
long long int XOR(long long int a, long long int b) { return a ^ b; }
int main() {
  long long int n, sum = 0;
  cin >> n;
  long long int a[n + 1];
  long long int dp[n + 1][n + 1];
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      dp[i][j] = -1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    dp[i][i] = 0;
  }
  for (int i = 1; i <= n - 1; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (dp[i][j] == -1) {
        dp[i][j] = XOR(a[i], a[j]);
        dp[j][i] = dp[i][j];
      }
    }
  }
  for (int i = 1; i <= n - 1; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      sum += dp[i][j];
    }
  }
  cout << sum % mod << endl;
  return 0;
}
