#include <bits/stdc++.h>
using namespace std;
int n, m, half;
long long k, sol, p[30][30];
map<long long, int> mp[30][30];
void rekdd(int x, int y, long long val, int dulj) {
  val ^= p[x][y];
  if (dulj == half) {
    mp[x][y][val]++;
    return;
  }
  if (x + 1 < n) rekdd(x + 1, y, val, dulj + 1);
  if (y + 1 < m) rekdd(x, y + 1, val, dulj + 1);
}
void rekgl(int x, int y, long long val, int dulj) {
  if (m + n - 2 - half == dulj) {
    if (mp[x][y].count(k ^ val)) sol += (long long)mp[x][y][k ^ val];
    return;
  }
  if (x - 1 >= 0) rekgl(x - 1, y, val ^ p[x][y], dulj + 1);
  if (y - 1 >= 0) rekgl(x, y - 1, val ^ p[x][y], dulj + 1);
}
int main() {
  scanf("%d %d %lld", &n, &m, &k);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%lld", &p[i][j]);
  half = (n + m - 2) / 2;
  rekdd(0, 0, 0, 0);
  rekgl(n - 1, m - 1, 0, 0);
  printf("%lld", sol);
  return 0;
}
