#include <bits/stdc++.h>
const int N = 20;
struct State {
  int x, y;
  long long val;
  State(int x = 0, int y = 0, long long val = 0) : x(x), y(y), val(val) {}
};
int n, m, mid;
long long a[N][N], k;
std::map<long long, int> res[N << 1];
int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);
  std::cin >> n >> m >> k;
  mid = (n + m - 2) >> 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      std::cin >> a[i][j];
    }
  }
  long long ans = 0;
  std::queue<State> que1, que2;
  que1.push(State(0, 0, a[0][0]));
  while (!que1.empty()) {
    State tmp = que1.front();
    que1.pop();
    int x = tmp.x, y = tmp.y;
    long long val = tmp.val;
    if (x + y == mid) {
      if (res[x].count(val)) {
        ++res[x][val];
      } else {
        res[x][val] = 1;
      }
    } else {
      if (x + 1 != n) que1.push(State(x + 1, y, val ^ a[x + 1][y]));
      if (y + 1 != m) que1.push(State(x, y + 1, val ^ a[x][y + 1]));
    }
  }
  que2.push(State(n - 1, m - 1, k));
  while (!que2.empty()) {
    State tmp = que2.front();
    que2.pop();
    int x = tmp.x, y = tmp.y;
    long long val = tmp.val;
    if (x + y == mid) {
      ans += res[x][val];
    } else {
      if (x - 1 >= 0) que2.push(State(x - 1, y, val ^ a[x][y]));
      if (y - 1 >= 0) que2.push(State(x, y - 1, val ^ a[x][y]));
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
