#include <bits/stdc++.h>
using namespace std;
const int MAXN = 25;
const int MAXM = 25;
int n, m;
long long k, ans;
long long a[MAXN][MAXM];
map<long long, long long> f[MAXN * 2][MAXM * 2];
int main() {
  scanf("%d%d%lld", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) scanf("%lld", &a[i][j]);
  int x = n + m - 2, y = x / 2;
  int t = (1 << y);
  for (int s = 0; s < t; s++) {
    int p = 1, q = 1;
    long long r = 0;
    for (int i = 0; i < y; i++) {
      if ((1 << i) & s)
        r ^= a[++p][q];
      else
        r ^= a[p][++q];
      if (p > n || q > m) break;
    }
    if (p <= n && q <= m) f[p][q][r ^ a[1][1]]++;
  }
  y = x - y;
  t = (1 << y);
  for (int s = 0; s < t; s++) {
    int p = n, q = m;
    long long r = 0;
    for (int i = 0; i < y; i++) {
      if ((1 << i) & s)
        r ^= a[p--][q];
      else
        r ^= a[p][q--];
      if (p < 1 || q < 1) break;
    }
    if (p >= 1 && q >= 1) ans += f[p][q][k ^ r];
  }
  printf("%lld\n", ans);
}
