#include <bits/stdc++.h>
using namespace std;
int n, m;
long long k;
long long a[21][21];
map<long long, int> mp[21][21];
int Color[21][21];
queue<pair<int, int>> q;
void BFS(int x, int y, int depthMax, vector<pair<int, int>> d) {
  Color[x][y] = 1;
  mp[x][y][a[x][y]] = 1;
  q.push(make_pair(x, y));
  while (!q.empty()) {
    tie(x, y) = q.front();
    q.pop();
    if (Color[x][y] == depthMax) {
      continue;
    }
    for (auto i : d) {
      int u = x + i.first, v = y + i.second;
      if (u > 0 && u <= n && v > 0 && v <= m) {
        for (auto it : mp[x][y]) {
          mp[u][v][a[u][v] ^ it.first] += it.second;
        }
        if (Color[u][v] == 0) {
          Color[u][v] = Color[x][y] + 1;
          q.push(make_pair(u, v));
        }
      }
    }
  }
}
long long GetMap(map<long long, int> &mp, long long x) {
  auto it = mp.find(x);
  return (it == mp.end() ? 0 : it->second);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  if (n == 1 && m == 1) {
    cout << (a[1][1] == k ? 1 : 0);
    return 0;
  }
  int numStep = (n + m - 1) / 2;
  BFS(1, 1, numStep,
      vector<pair<int, int>>({make_pair(1, 0), make_pair(0, 1)}));
  BFS(n, m, (n + m - 1) - numStep,
      vector<pair<int, int>>({make_pair(-1, 0), make_pair(0, -1)}));
  long long Ans = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (i + j - 1 == numStep && Color[i][j] == numStep) {
        for (auto x : mp[i][j]) {
          long long tmp = 0;
          if (i + 1 <= n) {
            tmp += GetMap(mp[i + 1][j], x.first ^ k);
          }
          if (j + 1 <= m) {
            tmp += GetMap(mp[i][j + 1], x.first ^ k);
          }
          Ans += 1LL * tmp * x.second;
        }
        break;
      }
    }
  }
  cout << Ans;
  return 0;
}
