#include <bits/stdc++.h>
using namespace std;
const int N = 25;
struct node {
  int x, y;
  long long scr;
};
long long sum, k, mapp[N][N], dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int n, m;
map<long long, long long> ans[N][N];
queue<node> pn;
int main() {
  scanf("%d%d%lld", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%lld", &mapp[i][j]);
  int ed = (n + m) / 2;
  if (n == 1 && m == 1) {
    if (mapp[1][1] == k)
      printf("1\n");
    else
      printf("0\n");
    return 0;
  }
  pn.push((node){1, 1, mapp[1][1]});
  ans[1][1][mapp[1][1]]++;
  while (!pn.empty()) {
    node u = pn.front();
    pn.pop();
    int x = u.x, y = u.y;
    long long scr = u.scr;
    for (int i = 0; i < 2; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if (nx + ny > ed || nx > n || ny > m) continue;
      pn.push((node){nx, ny, scr ^ mapp[nx][ny]});
      ans[nx][ny][scr ^ mapp[nx][ny]]++;
    }
  }
  while (!pn.empty()) pn.pop();
  pn.push((node){n, m, mapp[n][m]});
  while (!pn.empty()) {
    node u = pn.front();
    pn.pop();
    int x = u.x, y = u.y;
    long long scr = u.scr;
    for (int i = 2; i < 4; i++) {
      int nx = x + dx[i], ny = y + dy[i];
      if (nx + ny < ed || nx < 1 || ny < 1) continue;
      pn.push((node){nx, ny, scr ^ mapp[nx][ny]});
      sum += ans[nx][ny][scr ^ k];
    }
  }
  printf("%lld", sum);
  return 0;
}
