#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
int lim = 0, lim1;
long long a[100][100];
unordered_map<long long, long long> mp[25][25];
void Solve1(int x, int y, long long xr, int d = 1) {
  xr ^= a[x][y];
  if (d == lim) {
    mp[x][y][xr]++;
    return;
  }
  if (y > 0) Solve1(x, y - 1, xr, d + 1);
  if (x > 0) Solve1(x - 1, y, xr, d + 1);
}
long long Solve(int x, int y, long long xr, int d = 1) {
  if (d == lim1) {
    xr ^= k;
    return mp[x][y][xr];
  }
  xr ^= a[x][y];
  long long res = 0;
  if (x < n - 1) res += Solve(x + 1, y, xr, d + 1);
  if (y < m - 1) res += Solve(x, y + 1, xr, d + 1);
  return res;
}
int main() {
  cin >> n >> m >> k;
  lim = (n + m) / 2;
  lim1 = (n + m) - lim;
  for (int i = 0; i < n; i++) {
    for (int l = 0; l < m; l++) {
      cin >> a[i][l];
    }
  }
  Solve1(n - 1, m - 1, 0);
  cout << Solve(0, 0, 0) << endl;
  return 0;
}
