#include <bits/stdc++.h>
using namespace std;
const int MAXN = 21;
long long N, M, K;
long long grid[MAXN][MAXN];
map<long long, long long> path1[MAXN][MAXN];
map<long long, long long> path2[MAXN][MAXN];
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> N >> M >> K;
  for (int a = 1; a <= N; a++) {
    for (int b = 1; b <= M; b++) {
      cin >> grid[a][b];
    }
  }
  int mid = (N + M + 2) / 2;
  path1[1][1][0] = 1;
  for (int a = 1; a <= N; a++) {
    for (int b = 1; b <= M && a + b + 1 <= mid; b++) {
      if (a != N) {
        for (pair<long long, long long> p : path1[a][b]) {
          path1[a + 1][b][p.first ^ grid[a][b]] += p.second;
        }
      }
      if (b != M) {
        for (pair<long long, long long> p : path1[a][b]) {
          path1[a][b + 1][p.first ^ grid[a][b]] += p.second;
        }
      }
    }
  }
  path2[N][M][0] = 1;
  for (int a = N; a >= 1; a--) {
    for (int b = M; b >= 1 && a + b - 1 >= mid; b--) {
      if (a != 1) {
        for (pair<long long, long long> p : path2[a][b]) {
          path2[a - 1][b][p.first ^ grid[a][b]] += p.second;
        }
      }
      if (b != 1) {
        for (pair<long long, long long> p : path2[a][b]) {
          path2[a][b - 1][p.first ^ grid[a][b]] += p.second;
        }
      }
    }
  }
  long long ans = 0;
  for (int a = 1; a <= N; a++) {
    int b = mid - a;
    if (b < 0 || M < b) {
      continue;
    }
    for (pair<long long, long long> p : path1[a][b]) {
      ans += p.second * path2[a][b][K ^ p.first ^ grid[a][b]];
    }
  }
  cout << ans;
}
