#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 24;
long long a[MAXN][MAXN];
long long n, m, k, ans;
map<long long, long long> mp[MAXN][MAXN], mp2[MAXN][MAXN];
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cerr << "HELLO WORLD :)\n";
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) cin >> a[i][j];
  mp[1][1][a[1][1]]++;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++)
      if (i + j <= n) {
        for (auto u : mp[i - 1][j]) mp[i][j][u.first ^ a[i][j]] += u.second;
        for (auto u : mp[i][j - 1]) mp[i][j][u.first ^ a[i][j]] += u.second;
      }
  mp2[n][m][a[n][m]]++;
  for (long long i = n; i; i--)
    for (long long j = m; j; j--)
      if (i + j >= n) {
        for (auto u : mp2[i + 1][j]) mp2[i][j][u.first ^ a[i][j]] += u.second;
        for (auto u : mp2[i][j + 1]) mp2[i][j][u.first ^ a[i][j]] += u.second;
      }
  if (n == 1 || m == 1) {
    long long v = 0;
    for (long long i = 1; i <= n; i++)
      for (long long j = 1; j <= m; j++) v ^= a[i][j];
    return cout << (v == k) << '\n', false;
  }
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++)
      if (i + j == n) {
        for (auto u : mp[i][j])
          ans += mp2[i][j][k ^ u.first ^ a[i][j]] * u.second;
      }
  return cout << ans << '\n', false;
}
