#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define len(x) ((int)(x).size())
#define x first
#define y second
using ll = long long;
using llu = unsigned long long;
using lld = long double;
const int NM = 25;
int n, m;
ll k, a[NM][NM];
const ll TIME = chrono::high_resolution_clock::now().time_since_epoch().count();
const ll SEED = (ll)(new ll);
const ll RANDOM = TIME ^ SEED;
const ll MOD = (int)1e9+7;
struct chash{
int operator()(ll x) const { return std::hash<int>{}((x ^ RANDOM) % MOD); }
};
gp_hash_table<ll, int, chash> mp[NM][NM];
void right_bottom(int i, int j, int tot, ll mask = 0){
if(i >= n || j >= m) return;
mask ^= a[i][j];
if(i + j == tot){
mp[i][j][mask]++;
return;
}
right_bottom(i + 1, j, tot, mask);
right_bottom(i, j + 1, tot, mask);
}
ll left_up(int i, int j, int tot, ll mask = 0){
if(i < 0 || j < 0) return 0;
if(n + m - i - j - 2 == tot){
if(mp[i][j].find(k ^ mask) == mp[i][j].end()) return 0;
return mp[i][j][k ^ mask];
}
mask ^= a[i][j];
return left_up(i - 1, j, tot, mask) + left_up(i, j - 1, tot, mask);
}
int main(){
scanf("%d %d %lld", &n, &m, &k);
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
scanf("%lld", &a[i][j]);
}
}
int total_len = n + m - 2;
right_bottom(0, 0, total_len/2);
printf("%lld\n", left_up(n - 1, m - 1, total_len - total_len/2));
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9wYmRzOwoKI2RlZmluZSBsZW4oeCkgKChpbnQpKHgpLnNpemUoKSkKI2RlZmluZSB4IGZpcnN0CiNkZWZpbmUgeSBzZWNvbmQKCnVzaW5nIGxsID0gbG9uZyBsb25nOwp1c2luZyBsbHUgPSB1bnNp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