#include <bits/stdc++.h>
using namespace std;
template <class T>
bool ckmax(T& x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <class T>
bool ckmin(T& x, T y) {
  return x > y ? x = y, 1 : 0;
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f ? x : -x;
}
const int N = 25;
int n, m, b[N][N], tot;
long long k, ans, a[N][N];
map<long long, int> mp[N * N];
void dfs1(int x, int y, long long v) {
  if (x == n && y == m) return ans += v == k, void();
  if (x < n) dfs1(x + 1, y, v ^ a[x + 1][y]);
  if (y < m) dfs1(x, y + 1, v ^ a[x][y + 1]);
}
void dfs2(int x, int y, long long v) {
  if (b[x][y]) return mp[b[x][y]][v]++, void();
  if (x < n) dfs2(x + 1, y, v ^ a[x + 1][y]);
  if (y < m) dfs2(x, y + 1, v ^ a[x][y + 1]);
}
void dfs3(int x, int y, long long v) {
  if (b[x][y]) return mp[b[x][y]][v]++, void();
  if (x > 1) dfs3(x - 1, y, v ^ a[x - 1][y]);
  if (y > 1) dfs3(x, y - 1, v ^ a[x][y - 1]);
}
signed main() {
  cin >> n >> m >> k;
  for (int i = 1, iend = n; i <= iend; ++i)
    for (int j = 1, jend = m; j <= jend; ++j) cin >> a[i][j];
  if (n <= 6 && m <= 6) {
    dfs1(1, 1, a[1][1]);
    cout << ans;
    return 0;
  }
  for (int i = 1, iend = n; i <= iend; ++i)
    for (int j = 1, jend = m; j <= jend; ++j) {
      if (i + j - 2 == (n + m - 2) >> 1) {
        b[i][j] = ++tot;
        if (j < m && !b[i][j + 1]) b[i][j + 1] = ++tot;
        if (i < n && !b[i + 1][j]) b[i + 1][j] = ++tot;
      }
    }
  dfs2(1, 1, a[1][1]), dfs3(n, m, a[n][m]);
  for (int i = 1, iend = n; i <= iend; ++i)
    for (int j = 1, jend = m; j <= jend; ++j) {
      if (i < n && b[i][j] && b[i + 1][j]) {
        for (auto t : mp[b[i][j]])
          ans += 1ll * t.second * mp[b[i + 1][j]][k ^ t.first];
      }
      if (j < m && b[i][j] && b[i][j + 1]) {
        for (auto t : mp[b[i][j]])
          ans += 1ll * t.second * mp[b[i][j + 1]][k ^ t.first];
      }
    }
  cout << ans << '\n';
}
