#include <bits/stdc++.h>
int main() {
  int a, b, c, x, y, x1, y1, j, i;
  int c1 = 0;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  int w[b], w1[b], r[c * 2], r1[c * 2];
  for (i = 0; i < a; i++) {
    scanf("%d", &x);
    scanf("%d", &y);
    w[0] = x + y;
    for (j = 1; j < b - 1; j++) scanf("%d", &w[j]);
    scanf("%d", &x1);
    scanf("%d", &y1);
    w1[0] = x1 + y1;
    for (j = 1; j < b - 1; j++) scanf("%d", &w1[j]);
    for (j = 0; j < c * 2; j++) scanf("%d", &r[j]);
    for (j = 0; j < b - 1; j++) {
      if (w[j] < w1[j]) c1 = c1 + 1;
    }
    printf("%d", c1);
  }
}
