#include <bits/stdc++.h>
using namespace std;
const int LN = 20;
long long A[LN][LN], N, M, K, ans, mid;
map<long long, long long> cnt[LN][LN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> M >> K;
  mid = (N + M) / 2;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) cin >> A[i][j];
  map<long long, long long>::iterator it;
  cnt[0][0][A[0][0]] = 1;
  cnt[N - 1][M - 1][A[N - 1][M - 1]] = 1;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) {
      if ((i + j + 1) >= mid) continue;
      for (it = cnt[i][j].begin(); it != cnt[i][j].end(); it++) {
        if (i + 1 < N) cnt[i + 1][j][it->first xor A[i + 1][j]] += it->second;
        if (j + 1 < M) cnt[i][j + 1][it->first xor A[i][j + 1]] += it->second;
      }
    }
  for (int i = N - 1; i >= 0; i--)
    for (int j = M - 1; j >= 0; j--) {
      if ((i + j) == mid) {
        for (it = cnt[i][j].begin(); it != cnt[i][j].end(); it++) {
          if (i - 1 >= 0 && cnt[i - 1][j].count(K xor it->first))
            ans += it->second * cnt[i - 1][j][K xor it->first];
          if (j - 1 >= 0 && cnt[i][j - 1].count(K xor it->first))
            ans += it->second * cnt[i][j - 1][K xor it->first];
        }
        continue;
      }
      if ((i + j) < mid) continue;
      for (it = cnt[i][j].begin(); it != cnt[i][j].end(); it++) {
        if (i - 1 >= 0) cnt[i - 1][j][it->first xor A[i - 1][j]] += it->second;
        if (j - 1 >= 0) cnt[i][j - 1][it->first xor A[i][j - 1]] += it->second;
      }
    }
  if (N == 1 && M == 1 && A[0][0] == K) ans = 1;
  cout << ans;
  return 0;
}
