#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
using pll = pair<ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using vvll = vector<vll>;
set<ll> mtx[21][21];
map<ll, ll> cnts[21][21];
set<ll> mtx2[21][21];
map<ll, ll> cnts2[21][21];
ll inA[21][21];
ll in[21][21];
signed main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  ll n, m;
  ll k;
  cin >> n >> m >> k;
  for (ll i = 0; i < (ll)n; ++i) {
    for (ll j = 0; j < (ll)m; ++j) {
      cin >> inA[i][j];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (n > m) {
        in[j][i] = inA[i][j];
      } else {
        in[i][j] = inA[i][j];
      }
    }
  }
  if (n > m) swap(n, m);
  mtx[n - 1][m - 1].insert(in[n - 1][m - 1] ^ k);
  cnts[n - 1][m - 1][in[n - 1][m - 1] ^ k]++;
  mtx2[0][0].insert(in[0][0]);
  cnts2[0][0][in[0][0]]++;
  for (ll i = 0; i < min(n, m); ++i) {
    for (ll j = 0; j <= i; ++j) {
      ll r = n - 1 - j;
      ll c = m - i + j - 1;
      for (auto k = mtx[r][c].begin(); k != mtx[r][c].end(); ++k) {
        if (r - 1 >= 0) {
          mtx[r - 1][c].insert(*k ^ in[r - 1][c]);
          cnts[r - 1][c][*k ^ in[r - 1][c]] += cnts[r][c][*k];
        }
        if (c - 1 >= 0) {
          mtx[r][c - 1].insert(*k ^ in[r][c - 1]);
          cnts[r][c - 1][*k ^ in[r][c - 1]] += cnts[r][c][*k];
        }
      }
      if (r + 1 < n) mtx[r + 1][c].clear(), cnts[r + 1][c].clear();
      if (c + 1 < m) mtx[r][c + 1].clear(), cnts[r][c + 1].clear();
    }
  }
  for (ll i = 0; i < max(n, m); ++i) {
    for (ll j = 0; j <= min(n - 1, i); ++j) {
      ll r = min(n - 1, i) - j;
      ll c = j + max(0LL, i - min(n - 1, m - 1));
      for (auto k = mtx2[r][c].begin(); k != mtx2[r][c].end(); ++k) {
        if (r + 1 < n) {
          mtx2[r + 1][c].insert((*k) ^ in[r + 1][c]);
          cnts2[r + 1][c][(*k) ^ in[r + 1][c]] += cnts2[r][c][*k];
        }
        if (c + 1 < m) {
          mtx2[r][c + 1].insert((*k) ^ in[r][c + 1]);
          cnts2[r][c + 1][(*k) ^ in[r][c + 1]] += cnts2[r][c][*k];
        }
        if (r - 1 >= 0) mtx2[r - 1][c].clear(), cnts2[r - 1][c].clear();
        if (c - 1 >= 0) mtx2[r][c - 1].clear(), cnts2[r][c - 1].clear();
      }
    }
  }
  ll res = 0;
  ll i = max(n, m) - 1;
  for (ll j = 0; j <= min(n - 1, i); ++j) {
    ll r = min(n - 1, i) - j;
    ll c = j + max(0LL, i - min(n - 1, m - 1));
    for (auto k = mtx2[r][c].begin(); k != mtx2[r][c].end(); ++k) {
      res += cnts[r][c][*k ^ in[r][c]] * cnts2[r][c][*k];
    }
  }
  cout << res << endl;
  return 0;
}
