#include <bits/stdc++.h>
using namespace std;
const int N = 26;
long long a[N][N];
std::map<pair<pair<int, int>, long long>, long long> wa;
int n, m, g1, g2;
long long k, ans;
bool valid(int r, int c) { return (r < n && c < m && r >= 0 && c >= 0); }
void go1(int i, int j, int cnt, long long curr) {
  if (!valid(i, j)) return;
  if (cnt == n - 1) {
    wa[{{i, j}, curr ^ a[i][j]}]++;
    return;
  }
  go1(i + 1, j, cnt + 1, curr ^ a[i][j]);
  go1(i, j + 1, cnt + 1, curr ^ a[i][j]);
}
void go2(int i, int j, int cnt, long long curr) {
  if (!valid(i, j)) return;
  if (cnt == m - 1) {
    ans += wa[{{i, j}, curr ^ k}];
    return;
  }
  go2(i - 1, j, cnt + 1, curr ^ a[i][j]);
  go2(i, j - 1, cnt + 1, curr ^ a[i][j]);
}
int main() {
  scanf("%d %d %lld", &n, &m, &k);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%lld", &a[i][j]);
    }
  }
  go1(0, 0, 0, 0);
  go2(n - 1, m - 1, 0, 0);
  printf("%lld\n", ans);
  return 0;
}
