#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const long long inf = 1e+10;
const long long MAXN = 1e5;
const long long mod = 1e9 + 7;
long long a[20][20];
map<long long, map<long long, long long> > mp;
long long get(long long pc, long long x) {
  if (mp[pc].count(x)) {
    return mp[pc][x];
  }
  return 0;
}
void add(long long pc, long long x) {
  if (mp[pc].count(x)) {
    mp[pc][x]++;
  } else {
    mp[pc].insert({x, 1});
  }
}
signed main() {
  long long n, m, k;
  cin >> n >> m >> k;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  if (max(n, m) == n + m - 1) {
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        ans ^= a[i][j];
      }
    }
    if (ans == k) {
      cout << 1;
    } else {
      cout << 0;
    }
    return 0;
  }
  vector<vector<long long> > p;
  for (long long mask = 0; mask < (1 << (n - 1)); mask++) {
    long long pc = __builtin_popcount(mask);
    if (n - pc <= m) {
      long long ans = 0;
      long long cnt = 0;
      long long i = 0;
      long long j = 0;
      while (cnt < n - 1) {
        ans ^= a[i][j];
        if ((mask >> cnt) & 1) {
          i++;
        } else {
          j++;
        }
        cnt++;
      }
      p.push_back({ans, n - 1 - pc, i, j});
    }
  }
  for (long long mask = 0; mask < (1 << (m - 1)); mask++) {
    long long pc = __builtin_popcount(mask);
    if (pc <= n) {
      long long ans = 0;
      long long cnt = 0;
      long long i = n - 1;
      long long j = m - 1;
      while (cnt < m) {
        ans ^= a[i][j];
        if ((mask >> cnt) & 1) {
          i--;
        } else {
          j--;
        }
        cnt++;
      }
      add(pc, ans);
    }
  }
  long long ans = 0;
  for (auto x : p) {
    long long t = x[0] ^ k;
    ans += get(x[1], t);
  }
  cout << ans;
}
