#include <bits/stdc++.h>
using namespace std;
const int64_t N = 2e5 + 5;
const int64_t INF = 1e18;
const int64_t MOD = 998244353;
int64_t n, m, k;
int64_t a[25][25];
int64_t ans = 0;
map<int64_t, int64_t> v[25][25];
int64_t half;
void f(int64_t x, int64_t y, int64_t val, int64_t cnt) {
  val ^= a[x][y];
  if (cnt == half) {
    v[x][y][val]++;
    return;
  }
  if (x + 1 < n) f(x + 1, y, val, cnt + 1);
  if (y + 1 < m) f(x, y + 1, val, cnt + 1);
}
void f2(int64_t x, int64_t y, int64_t val, int64_t cnt) {
  if (cnt == (n + m - 2 - half)) {
    ans += v[x][y][val ^ k];
    return;
  }
  val ^= a[x][y];
  if (x > 0) f2(x - 1, y, val, cnt + 1);
  if (y > 0) f2(x, y - 1, val, cnt + 1);
}
int32_t main() {
  cin >> n >> m >> k;
  half = (n + m - 2) / 2;
  for (int64_t i = 0; i < n; i++)
    for (int64_t j = 0; j < m; j++) cin >> a[i][j];
  f(0, 0, 0, 0);
  f2(n - 1, m - 1, 0, 0);
  cout << ans << endl;
}
