#include <bits/stdc++.h>
using namespace std;
int n, m;
long long int a[25][25], ans = 0, k;
map<long long int, long long int> mp[25];
void dfs1(int r, int c, long long int xr) {
  if (r < 0 || c < 0 || r >= n || c >= m) return;
  if (r + c == m - 1) {
    mp[r][xr ^ a[r][c]]++;
    ;
    return;
  }
  dfs1(r, c + 1, xr ^ a[r][c]);
  dfs1(r + 1, c, xr ^ a[r][c]);
}
void dfs2(int r, int c, long long int xr) {
  if (r < 0 || c < 0 || r >= n || c >= m) return;
  if (r + c == m - 1) {
    auto it = mp[r].find(k ^ xr);
    if (it != mp[r].end()) ans += it->second;
    return;
  }
  dfs2(r, c - 1, xr ^ a[r][c]);
  dfs2(r - 1, c, xr ^ a[r][c]);
}
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", &a[i][j]);
  dfs1(0, 0, 0);
  dfs2(n - 1, m - 1, 0);
  printf("%lld\n", ans);
  return 0;
}
