#include <bits/stdc++.h>
using namespace std;
int R, C;
long long g[20][20], k;
map<long long, int> mp[20][20];
int main() {
  scanf("%d%d", &R, &C);
  scanf("%lld", &k);
  for (int i = 0; i < R; ++i)
    for (int j = 0; j < C; ++j) scanf("%lld", &g[i][j]);
  int len = (R + C - 2);
  int half = len / 2;
  for (int mask = 0; mask < (1 << half); ++mask) {
    int r = 0, c = 0;
    long long xr = g[r][c];
    for (int i = 0; i < half; ++i) {
      if ((mask >> i) & 1)
        ++r;
      else
        ++c;
      if (r == R || c == C) {
        r = -1;
        break;
      }
      xr ^= g[r][c];
    }
    if (r == -1) continue;
    ++mp[r][c][xr];
  }
  half = len - half;
  long long res = 0;
  for (int mask = 0; mask < (1 << half); ++mask) {
    int r = R - 1, c = C - 1;
    long long xr = 0;
    for (int i = 0; i < half; ++i) {
      xr ^= g[r][c];
      if ((mask >> i) & 1)
        --r;
      else
        --c;
      if (r == -1 || c == -1) {
        r = -1;
        break;
      }
    }
    if (r == -1) continue;
    auto it = mp[r][c].find(xr ^ k);
    if (it != mp[r][c].end()) res += it->second;
  }
  printf("%lld\n", res);
  return 0;
}
