#include <bits/stdc++.h>
using namespace std;
int main() {
  int sumS = 0, n, s[10][10], i = 0, j = 0, k, m, p[10], count = 0;
  cin >> n >> m;
  cin >> k;
  while (i <= m) {
    while (j <= k) {
      cin >> s[i][j];
      j++;
    }
    i++;
  }
  i = 0;
  while (i <= m) {
    cin >> p[i];
    i++;
  }
  i = 0;
  j = 0;
  while (i <= m) {
    while (j <= k) {
      sumS += s[i][j];
      j++;
    }
    if (p[i] == 1 && sumS % 2 == 0) {
      count++;
    }
    if (p[i] == 0 && sumS % 2 == 1) {
      count++;
    }
    i++;
  }
  cout << count;
  return 0;
}
