#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp[1010];
long long a[110][110];
int n, m;
long long ans;
long long k;
struct node {
  int x, y;
  long long v;
  int deep;
};
queue<node> q;
void bfs1(int end) {
  node tmp, tmp1;
  q.push((node){1, 1, a[1][1], 1});
  while (!q.empty()) {
    tmp = q.front();
    q.pop();
    if (tmp.deep == end) {
      mp[tmp.x * 21 + tmp.y][tmp.v]++;
      continue;
    }
    tmp1 = tmp;
    if (tmp.x < n) {
      tmp1.x++;
      tmp1.v ^= a[tmp1.x][tmp1.y];
      tmp1.deep++;
      q.push(tmp1);
    }
    tmp1 = tmp;
    if (tmp.y < m) {
      tmp1.y++;
      tmp1.v ^= a[tmp1.x][tmp1.y];
      tmp1.deep++;
      q.push(tmp1);
    }
  }
}
void bfs2(int end) {
  node tmp, tmp1;
  q.push((node){n, m, a[n][m], 1});
  while (!q.empty()) {
    tmp = q.front();
    q.pop();
    if (tmp.deep == end) {
      ans += mp[tmp.x * 21 + tmp.y][k ^ a[tmp.x][tmp.y] ^ tmp.v];
      continue;
    }
    tmp1 = tmp;
    if (tmp.x > 1) {
      tmp1.x--;
      tmp1.v ^= a[tmp1.x][tmp1.y];
      tmp1.deep++;
      q.push(tmp1);
    }
    tmp1 = tmp;
    if (tmp.y > 1) {
      tmp1.y--;
      tmp1.v ^= a[tmp1.x][tmp1.y];
      tmp1.deep++;
      q.push(tmp1);
    }
  }
}
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", &a[i][j]);
    }
  }
  int d = (n + m) / 2;
  bfs1(d);
  bfs2(n + m - d);
  cout << ans << endl;
}
