#include <bits/stdc++.h>
using namespace std;
const int N = 22;
long long a[N][N];
void dfs(int i, int j, int s, int t, long long x,
         map<long long, long long>& ans) {
  x ^= a[i][j];
  if (i == s && j == t) {
    ans[x]++;
    return;
  }
  if (i + 1 <= s) dfs(i + 1, j, s, t, x, ans);
  if (j + 1 <= t) dfs(i, j + 1, s, t, x, ans);
}
map<long long, long long> ans[2];
void solve() {
  int n, m;
  long long x;
  cin >> n >> m >> x;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  long long tot = 0;
  for (int i = 1; i <= min(n, m); i++) {
    int j = m - i + 1;
    ans[0].clear();
    ans[1].clear();
    dfs(1, 1, i, j, 0, ans[0]);
    dfs(i, j, n, m, 0, ans[1]);
    for (map<long long, long long>::iterator it = ans[0].begin();
         it != ans[0].end(); ++it) {
      if (!ans[1].count((it->first) ^ x ^ a[i][j])) continue;
      tot += (it->second) * ans[1][(it->first) ^ x ^ a[i][j]];
    }
  }
  cout << tot << endl;
}
int main() {
  solve();
  return 0;
}
