#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;
const ll MUL = (int)1e6+3;
struct chash{
ll operator()(ll x) const { return std::hash<ll>{}((x ^ RANDOM) % MOD * MUL); }
};
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+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9wYmRzOwoKI2RlZmluZSBsZW4oeCkgKChpbnQpKHgpLnNpemUoKSkKI2RlZmluZSB4IGZpcnN0CiNkZWZpbmUgeSBzZWNvbmQKCnVzaW5nIGxsID0gbG9uZyBsb25n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