#include <bits/stdc++.h>
using namespace std;
const int NMAX = 27;
int n, m;
long long k, a[NMAX][NMAX], res;
map<long long, long long> M[NMAX][NMAX];
void Ides1(int first, int second, int brk, long long sad) {
  if (brk == (n + m) / 2) {
    M[first][second][sad]++;
    return;
  }
  if (second + 1 <= m)
    Ides1(first, second + 1, brk + 1, sad ^ a[first][second + 1]);
  if (first + 1 <= n)
    Ides1(first + 1, second, brk + 1, sad ^ a[first + 1][second]);
}
void Ideees2(int first, int second, int brk, long long sad) {
  if (brk == (n + m) - (n + m) / 2) {
    res += M[first][second][sad ^ k ^ a[first][second]];
    return;
  }
  if (second - 1 >= 1)
    Ideees2(first, second - 1, brk + 1, sad ^ a[first][second - 1]);
  if (first - 1 >= 1)
    Ideees2(first - 1, second, brk + 1, sad ^ a[first - 1][second]);
}
int main() {
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  }
  Ides1(1, 1, 1, a[1][1]);
  Ideees2(n, m, 1, a[n][m]);
  cout << res;
  return 0;
}
