#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B>
bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
long long inf = sizeof(long long) == sizeof(long long) ? 2e18 : 1e9 + 10;
long long dx[] = {0, 1, 0, -1};
long long dy[] = {1, 0, -1, 0};
long long w[] = {0, 0, 1, 1};
long long n, m, k;
vector<vector<long long> > in;
map<pair<long long, long long>, long long> ma[2];
void dfs(long long x, long long y, long long a, long long q) {
  if (x + y == k && q)
    ;
  else
    a ^= in[x][y];
  if (x + y == k) {
    ma[q][{x, a}]++;
    return;
  }
  for (long long i = 0; i < 4; i++)
    if (w[i] == q) {
      long long nx = x + dx[i];
      long long ny = y + dy[i];
      if (nx < 0 || ny < 0 || nx >= n || ny >= m) continue;
      dfs(nx, ny, a, q);
    }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  in = vector<vector<long long> >(n, vector<long long>(m));
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) cin >> in[i][j];
  in[0][0] ^= k;
  k = (n + m - 1) / 2;
  dfs(0, 0, 0, 0);
  dfs(n - 1, m - 1, 0, 1);
  long long out = 0;
  for (auto it : ma[0]) out += it.second * ma[1][it.first];
  cout << out << endl;
}
