#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <typename T>
void print(vector<T> s) {
  for (int i = 0; i < s.size(); i++) cout << s[i] << " ";
  cout << endl;
}
long long s[30][30];
int kek;
map<long long, long long> mapa[20];
void gen1(int x, int y, long long sum, int n, int m) {
  if (x + y == kek) {
    if (mapa[x].find(sum) == mapa[x].end())
      mapa[x][sum] = 1;
    else
      mapa[x][sum]++;
    return;
  }
  if (x + 1 < n) gen1(x + 1, y, (sum ^ s[x + 1][y]), n, m);
  if (y + 1 < m) gen1(x, y + 1, (sum ^ s[x][y + 1]), n, m);
}
long long answer = 0;
void gen2(int x, int y, long long sum, long long k) {
  if (x + y == kek) {
    long long need = k ^ s[x][y] ^ sum;
    if (mapa[x].find(need) != mapa[x].end()) answer += mapa[x][need];
    return;
  }
  if (x > 0) gen2(x - 1, y, (sum ^ s[x - 1][y]), k);
  if (y > 0) gen2(x, y - 1, (sum ^ s[x][y - 1]), k);
}
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  long long k;
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> s[i][j];
  if (n + m - 2 < 20)
    kek = n + m - 2;
  else
    kek = 20;
  gen1(0, 0, s[0][0], n, m);
  long long cnt = 0;
  if (n + m - 2 > kek) {
    gen2(n - 1, m - 1, s[n - 1][m - 1], k);
    cout << answer << endl;
  } else {
    cout << mapa[n - 1][k] << endl;
    return 0;
  }
  return 0;
}
