#include <bits/stdc++.h>
int g;
int n, m;
int64_t a[20][20], k;
std::unordered_map<int64_t, int> map[40];
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  std::cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      std::cin >> a[i][j];
    }
  }
  if ((n + m) <= 2) {
    int64_t ans = 0;
    for (int mask = 0; mask < (1 << (n + m - 2)); mask++) {
      std::pair<int, int> pos = {0, 0};
      int64_t x = a[0][0];
      for (int i = 0; i < (n + m - 2); i++) {
        pos.first += ((mask >> i) & 1);
        pos.second += 1 ^ ((mask >> i) & 1);
        if (pos.first >= n || pos.second >= m) {
          x = -1;
          break;
        }
        x ^= a[pos.first][pos.second];
      }
      if (x == k) {
        ans++;
      }
    }
    std::cout << ans << '\n';
    exit(0);
  }
  g = (n + m) / 2;
  for (int mask = 0; mask < (1 << g); mask++) {
    std::pair<int, int> pos = {0, 0};
    int64_t x = a[0][0];
    for (int i = 0; i < g; i++) {
      pos.first += (mask >> i) & 1;
      pos.second += 1 ^ ((mask >> i) & 1);
      if (pos.first >= n || pos.second >= m) {
        x = -1;
        break;
      }
      x ^= a[pos.first][pos.second];
    }
    if (x != -1) {
      map[pos.first][x]++;
    }
  }
  int64_t ans = 0;
  for (int r = 0; r <= g; r++) {
    const int p = r, q = g - r;
    if (p < n && q < m) {
      const int f = n + m - 2 - g;
      for (int mask = 0; mask < (1 << f); mask++) {
        int64_t x = 0;
        std::pair<int, int> pos = {p, q};
        for (int i = 0; i < f; i++) {
          pos.first += (mask >> i) & 1;
          pos.second += 1 ^ ((mask >> i) & 1);
          if (pos.first >= n || pos.second >= m) {
            x = -1;
            break;
          }
          x ^= a[pos.first][pos.second];
        }
        if (x != -1) {
          if (pos.first != (n - 1) || pos.second != (m - 1)) {
            exit(242);
          }
          auto it = map[r].find(k ^ x);
          if (it != map[r].end()) {
            ans += it->second;
          }
        }
      }
    }
  }
  std::cout << ans << '\n';
  std::cout.flush();
  return 0;
}
