#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 20;
const int M = 20;
int n, m;
ll k, a[N][M];
map<ll, int> xor_cnt[N][M];
int dist(int r, int c) { return r + c; }
void dfs0(int r, int c, ll sofar = 0) {
  if (r >= n || c >= m) return;
  if (dist(r, c) == (n + m - 1) / 2) {
    xor_cnt[r][c][sofar]++;
    return;
  }
  sofar ^= a[r][c];
  dfs0(r + 1, c, sofar);
  dfs0(r, c + 1, sofar);
}
ll dfs1(int r, int c, ll sofar = 0) {
  if (r < 0 || c < 0) return 0;
  sofar ^= a[r][c];
  if (dist(r, c) == (n + m - 1) / 2) {
    return xor_cnt[r][c][sofar ^ k];
  }
  return dfs1(r - 1, c, sofar) + dfs1(r, c - 1, sofar);
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  dfs0(0, 0);
  cout << dfs1(n - 1, m - 1) << "\n";
  return 0;
}
