#include <bits/stdc++.h>
using namespace std;
long long grid[25][25], mark[25][25];
long long m, n, k, res;
int dx[] = {1, 0};
int dy[] = {0, 1};
long long ans = 0;
map<long long, long long> adj[100];
bool valid(int i, int j) { return i >= 0 && i < n && j >= 0 && j < m; }
void build(int i, int j, long long cur) {
  if (!valid(i, j)) return;
  if ((i + j) == (n + m) / 2 - 1) {
    adj[j][cur ^ grid[i][j]]++;
    return;
  }
  build(i + 1, j, cur ^ grid[i][j]);
  build(i, j + 1, cur ^ grid[i][j]);
}
void match(int i, int j, long long cur) {
  if (!valid(i, j)) return;
  if ((i + j) == (n + m) / 2 - 1) {
    ans += adj[j][cur ^ k];
    return;
  }
  match(i - 1, j, cur ^ grid[i][j]);
  match(i, j - 1, cur ^ grid[i][j]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> grid[i][j];
    }
  }
  build(0, 0, 0);
  match(n - 1, m - 1, 0);
  cout << ans;
}
