#include <bits/stdc++.h>
using namespace std;
int n, m;
long long k, ans, a[21][21];
map<long long, int> dp[21][21];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  if (n == 1 && m == 1) {
    cout << (k == a[1][1]);
    return 0;
  }
  int tmp = (1 + 1 + n + m) / 2;
  dp[1][1][a[1][1]] = 1;
  dp[n][m][a[n][m]] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (i + j == 2) continue;
      if (i + j > tmp) break;
      if (j > 1)
        for (auto p : dp[i][j - 1]) dp[i][j][p.first ^ a[i][j]] += p.second;
      if (i > 1)
        for (auto p : dp[i - 1][j]) dp[i][j][p.first ^ a[i][j]] += p.second;
    }
  for (int i = n; i; i--)
    for (int j = m; j; j--) {
      if (i + j == n + m) continue;
      if (i + j == tmp) {
        if (j < m)
          for (auto p : dp[i][j + 1])
            ans += 1ll * p.second * dp[i][j][p.first ^ k];
        if (i < n)
          for (auto p : dp[i + 1][j])
            ans += 1ll * p.second * dp[i][j][p.first ^ k];
        break;
      }
      if (j < m)
        for (auto p : dp[i][j + 1]) dp[i][j][p.first ^ a[i][j]] += p.second;
      if (i < n)
        for (auto p : dp[i + 1][j]) dp[i][j][p.first ^ a[i][j]] += p.second;
    }
  cout << ans;
  return 0;
}
