#include <bits/stdc++.h>
long long ans;
int N, M, K, s[2505][2505], p[7], q[7];
inline int S(int a, int b, int c, int d) {
  return s[c][d] + s[a - 1][b - 1] - s[a - 1][d] - s[c][b - 1];
}
inline void work(int a, int b, int c, int d) {
  if (a == c && b == d) {
    ans += S(a, b, c, d) == K;
    return;
  }
  if (c - a > d - b) {
    int m = (a + c) >> 1;
    for (int i = b; i <= d; ++i) {
      for (int j = 0; j <= K; ++j) p[j] = m - a + 1, q[j] = c - m;
      for (int j = i; j >= b; --j) {
        for (int k = 0; k <= K; ++k) {
          while (k < S(m - p[k] + 1, j, m, i) && p[k]) p[k]--;
          while (k < S(m + 1, j, m + q[k], i) && q[k]) q[k]--;
        }
        for (int k = 0; k <= K; ++k)
          ans += (long long)(p[k] - (k ? p[k - 1] : 0)) *
                 (q[K - k] - (k != K ? q[K - k - 1] : 0));
      }
    }
    work(a, b, m, d);
    work(m + 1, b, c, d);
  } else {
    int m = (b + d) >> 1;
    for (int i = a; i <= c; ++i) {
      for (int k = 0; k <= K; ++k) p[k] = m - b + 1, q[k] = d - m;
      for (int j = i; j >= a; --j) {
        for (int k = 0; k <= K; ++k) {
          while (k < S(j, m - p[k] + 1, i, m) && p[k]) p[k]--;
          while (k < S(j, m + 1, i, m + q[k]) && q[k]) q[k]--;
        }
        for (int k = 0; k <= K; ++k)
          ans += (long long)(p[k] - (k ? p[k - 1] : 0)) *
                 (q[K - k] - (k != K ? q[K - k - 1] : 0));
      }
    }
    work(a, m + 1, c, d);
    work(a, b, c, m);
  }
}
int main() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j) {
      char ch = getchar();
      while (ch != '0' && ch != '1') ch = getchar();
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + ch - 48;
    }
  work(1, 1, N, M);
  printf("%I64d", ans);
}
