#include <bits/stdc++.h>
using namespace std;
long long Dp[25][25];
void Rec1(long long i, long long j, long long Value);
void Rec2(long long i, long long j, long long Value);
long long n, m, k;
long long Grid[25][25];
map<long long, long long> mp1[25][25];
map<long long, long long> mp2[25][25];
vector<pair<long long, long long> > Middle;
int main() {
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++)
    for (long long j = 1; j <= m; j++) {
      scanf("%I64d", &Grid[i][j]);
      if (i + j == n + 1) Middle.push_back(make_pair(i, j));
    }
  Rec1(1, 1, Grid[1][1]);
  Rec2(n, m, 0);
  long long Answer = 0;
  long long N = Middle.size();
  for (long long r = 0; r < N; ++r) {
    long long i = Middle[r].first;
    long long j = Middle[r].second;
    for (map<long long, long long>::iterator it = mp1[i][j].begin();
         it != mp1[i][j].end(); it++)
      Answer += (it->second) * mp2[i][j][k ^ (it->first)];
  }
  cout << Answer;
}
bool InRange(long long i, long long j) {
  return 1 <= i && i <= n && 1 <= j && j <= m;
}
void Rec1(long long i, long long j, long long Value) {
  if (i + j == n + 1) {
    mp1[i][j][Value]++;
    return;
  }
  if (InRange(i + 1, j)) Rec1(i + 1, j, Value ^ Grid[i + 1][j]);
  if (InRange(i, j + 1)) Rec1(i, j + 1, Value ^ Grid[i][j + 1]);
}
void Rec2(long long i, long long j, long long Value) {
  if (i + j == n + 1) {
    mp2[i][j][Value]++;
    return;
  }
  if (InRange(i - 1, j)) Rec2(i - 1, j, Value ^ Grid[i][j]);
  if (InRange(i, j - 1)) Rec2(i, j - 1, Value ^ Grid[i][j]);
}
