#include <bits/stdc++.h>
using namespace std;
map<long long, long long> Map[22][22], M[22][22];
long long a[22][22];
queue<pair<pair<int, int>, long long> > q;
int main() {
  int n, m;
  long long k;
  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 << (a[1][1] == k);
    return 0;
  }
  long long ans = 0;
  int limit = (n + m) / 2;
  Map[1][1][a[1][1]] = 1;
  q.push(make_pair(make_pair(1, 1), a[1][1]));
  while (!q.empty()) {
    pair<pair<int, int>, long long> b = q.front();
    q.pop();
    int cnt = b.first.first + b.first.second - 1;
    long long res = Map[b.first.first][b.first.second][b.second];
    if (b.first.first < n) {
      long long tmp = (b.second ^ a[b.first.first + 1][b.first.second]);
      if (cnt + 1 < limit && Map[b.first.first + 1][b.first.second][tmp] == 0)
        q.push(make_pair(make_pair(b.first.first + 1, b.first.second), tmp));
      Map[b.first.first + 1][b.first.second][tmp] += res;
    }
    if (b.first.second < m) {
      long long tmp = (b.second ^ a[b.first.first][b.first.second + 1]);
      if (cnt + 1 < limit && Map[b.first.first][b.first.second + 1][tmp] == 0)
        q.push(make_pair(make_pair(b.first.first, b.first.second + 1), tmp));
      Map[b.first.first][b.first.second + 1][tmp] += res;
    }
  }
  while (!q.empty()) q.pop();
  M[n][m][a[n][m]] = 1;
  q.push(make_pair(make_pair(n, m), a[n][m]));
  limit = (n + m - 1) - limit;
  while (!q.empty()) {
    pair<pair<int, int>, long long> b = q.front();
    q.pop();
    int cnt = n - b.first.first + m - b.first.second + 1;
    long long res = M[b.first.first][b.first.second][b.second];
    if (cnt == limit) {
      long long tmp = (b.second ^ k);
      if (b.first.first > 1)
        ans += (res * Map[b.first.first - 1][b.first.second][tmp]);
      if (b.first.second > 1)
        ans += (res * Map[b.first.first][b.first.second - 1][tmp]);
      continue;
    }
    if (b.first.first > 1) {
      long long tmp = (b.second ^ a[b.first.first - 1][b.first.second]);
      if (M[b.first.first - 1][b.first.second][tmp] == 0)
        q.push(make_pair(make_pair(b.first.first - 1, b.first.second), tmp));
      M[b.first.first - 1][b.first.second][tmp] += res;
    }
    if (b.first.second > 1) {
      long long tmp = (b.second ^ a[b.first.first][b.first.second - 1]);
      if (M[b.first.first][b.first.second - 1][tmp] == 0)
        q.push(make_pair(make_pair(b.first.first, b.first.second - 1), tmp));
      M[b.first.first][b.first.second - 1][tmp] += res;
    }
  }
  cout << ans;
  return 0;
}
