#include <bits/stdc++.h>
using namespace std;
int n, m;
long long k;
long long mat[25][25];
map<long long, int> dp[25][25];
int half;
long long solve = 0;
void First(int i, int j, long long mask, int cont) {
  mask ^= mat[i][j];
  if (cont == half) {
    dp[i][j][mask]++;
    return;
  }
  if (i + 1 <= n) First(i + 1, j, mask, cont + 1);
  if (j + 1 <= m) First(i, j + 1, mask, cont + 1);
}
void Second(int i, int j, long long mask, int cont) {
  if (cont == n + m - 2 - half) {
    if (dp[i][j].find(mask ^ k) != dp[i][j].end()) solve += dp[i][j][mask ^ k];
    return;
  }
  if (i - 1 > 0) Second(i - 1, j, mask ^ mat[i][j], cont + 1);
  if (j - 1 > 0) Second(i, j - 1, mask ^ mat[i][j], cont + 1);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i < n + 1; ++i)
    for (int j = 1; j < m + 1; ++j) cin >> mat[i][j];
  half = (n + m - 2) / 2;
  First(1, 1, 0, 0);
  Second(n, m, 0, 0);
  cout << solve << '\n';
}
