#include <bits/stdc++.h>
using namespace std;
long long a[20 + 5][20 + 5];
map<long long, long long> M1[20 + 5][20 + 5], M2[20 + 5][20 + 5];
int n, m;
void dfs1(int x, int y, long long now, int step) {
  if (step == 0) {
    M1[x][y][now]++;
    return;
  }
  if (x < n) dfs1(x + 1, y, now ^ a[x + 1][y], step - 1);
  if (y < m) dfs1(x, y + 1, now ^ a[x][y + 1], step - 1);
}
void dfs2(int x, int y, long long now, int step) {
  if (step == 0) {
    M2[x][y][now]++;
    return;
  }
  if (x > 1) dfs2(x - 1, y, now ^ a[x - 1][y], step - 1);
  if (y > 1) dfs2(x, y - 1, now ^ a[x][y - 1], step - 1);
}
int main() {
  long long k;
  scanf("%d%d%I64d", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%I64d", &a[i][j]);
  int s1 = (n + m - 2) >> 1, s2 = (n + m - 2) - s1;
  dfs1(1, 1, a[1][1], s1);
  dfs2(n, m, a[n][m], s2);
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (!M1[i][j].empty()) {
        for (auto it : M1[i][j]) {
          long long x = it.first ^ a[i][j] ^ k, cnt = it.second;
          ans += cnt * M2[i][j][x];
        }
      }
  printf("%I64d\n", ans);
  return 0;
}
