#include <bits/stdc++.h>
using namespace std;
uint64_t a[20][20];
map<uint64_t, uint64_t> l[20], r[20];
uint64_t k, n, m, ans;
uint64_t lc, rc;
void makel(int i, int j, uint64_t val) {
  lc++;
  if (i == n || j == m || i + j > n - 1) return;
  val ^= a[i][j];
  if (i + j == n - 1) l[i][(val ^ a[i][j])]++;
  makel(i + 1, j, val);
  makel(i, j + 1, val);
}
void maker(int i, int j, uint64_t val) {
  rc++;
  if (j < 0 || i < 0 || i + j < n - 1) return;
  val ^= a[i][j];
  if (i + j == n - 1) r[i][val]++;
  maker(i - 1, j, val);
  maker(i, j - 1, val);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(NULL));
  cin >> n >> m >> k;
  if (n > m) {
    swap(n, m);
    for (int i = 0; i < m; ++i)
      for (int j = 0; j < n; ++j) cin >> a[j][i];
  } else {
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) cin >> a[i][j];
  }
  makel(0, 0, 0);
  maker(n - 1, m - 1, 0);
  for (int i = 0; i < m; ++i) {
    for (auto it : l[i]) {
      auto jt = r[i].find(it.first ^ k);
      if (jt != r[i].end()) ans += it.second * jt->second;
    }
  }
  cout << ans;
  return 0;
}
