#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vint = vector<int>;
class solver {
 public:
  void solve(int n) {
    int m;
    ll k;
    cin >> m >> k;
    ll ans = 0;
    vector<vector<ll>> val(n);
    for (int i = 0; i < n; i++) {
      val[i].resize(m);
      for (auto &it : val[i]) {
        cin >> it;
      }
    }
    int to_step = min(19, (n - 1) + (m - 1));
    int back_step = (n - 1) + (m - 1) - to_step;
    vector<vector<unordered_map<ll, ll>>> got(n);
    for (int i = 0; i < n; i++) {
      got[i].resize(m);
    }
    for (int mask = 0; mask < (1 << to_step); mask++) {
      int cur_a = 0, cur_b = 0;
      ll cur = val[0][0];
      bool failed = false;
      for (int i = 0; i < to_step; i++) {
        if (mask & (1 << i)) {
          cur_a++;
        } else {
          cur_b++;
        }
        if (cur_a >= n || cur_b >= m) {
          failed = true;
          break;
        }
        cur ^= val[cur_a][cur_b];
      }
      if (!failed) {
        got[cur_a][cur_b][cur]++;
      }
    }
    for (int mask = 0; mask < (1 << back_step); mask++) {
      int cur_a = n - 1, cur_b = m - 1;
      ll cur = val[cur_a][cur_b];
      bool failed = false;
      for (int i = 0; i < back_step; i++) {
        if (mask & (1 << i)) {
          cur_a--;
        } else {
          cur_b--;
        }
        if (cur_a < 0 || cur_b < 0) {
          failed = true;
          break;
        }
        cur ^= val[cur_a][cur_b];
      }
      if (!failed) {
        ans += got[cur_a][cur_b][cur ^ k ^ val[cur_a][cur_b]];
      }
    }
    cout << ans << endl;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  while (cin >> n) {
    solver s;
    s.solve(n);
  }
}
