#include <bits/stdc++.h>
using namespace std;
long long a[30][30];
long long n, m, k, ans = 0, half;
unordered_map<long long, long long> cnt[25][25];
void firstHalf(long long i, long long j, long long Xor, long long step) {
  Xor ^= a[i][j];
  if (step == half) {
    cnt[i][j][Xor]++;
    return;
  }
  if (i + 1 < n) firstHalf(i + 1, j, Xor, step + 1);
  if (j + 1 < m) firstHalf(i, j + 1, Xor, step + 1);
}
void secondHalf(long long i, long long j, long long Xor, long long step) {
  if (step == n + m - 2 - half) {
    ans += (cnt[i][j][Xor ^ k]);
    return;
  }
  if (i > 0) secondHalf(i - 1, j, Xor ^ a[i][j], step + 1);
  if (j > 0) secondHalf(i, j - 1, Xor ^ a[i][j], step + 1);
}
int main() {
  cin >> n >> m >> k;
  half = (n + m - 2) / 2;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) cin >> a[i][j];
  firstHalf(0, 0, 0, 0);
  secondHalf(n - 1, m - 1, 0, 0);
  cout << ans;
  return 0;
}
