#include <bits/stdc++.h>
using namespace std;
int l[2505][2505], r[2505][2505], ll[10], rr[10], L1, L2, p[10], c[10], o, i, j,
    n, m, k, now, D[2505][2505], U[2505][2505];
char s[2505][2505];
long long ans;
void cdq(int X1, int Y1, int X2, int Y2) {
  if (X1 == X2 && Y1 == Y2) {
    if (s[X1 - 1][Y1 - 1] - '0' == k) ans++;
    return;
  }
  int mid;
  if (X2 - X1 >= Y2 - Y1) {
    mid = (X2 + X1) / 2;
    if (X1 != X2) {
      cdq(X1, Y1, mid, Y2);
      cdq(mid + 1, Y1, X2, Y2);
    }
  } else {
    mid = (Y1 + Y2) / 2;
    if (Y1 != Y2) {
      cdq(X1, Y1, X2, mid);
      cdq(X1, mid + 1, X2, Y2);
    }
  }
  int i, j, t;
  if (X2 - X1 < Y2 - Y1) {
    for (i = X1; i <= X2; i++) {
      for (j = 1; j <= 7; j++) ll[j] = Y1 - 1, rr[j] = Y2 + 1;
      ll[0] = mid;
      rr[0] = mid + 1;
      for (j = i; j <= X2; j++) {
        now = mid + 1;
        o = 0;
        while (now >= Y1) {
          now = l[j][now];
          if (now >= Y1) p[++o] = now;
          if (o == k + 1) break;
        }
        L1 = 1;
        L2 = 1;
        for (t = 1; t <= k + 1; t++) {
          if (L1 <= k + 1 && (L2 > o || ll[L1] > p[L2])) {
            c[t] = ll[L1];
            L1++;
          } else {
            c[t] = p[L2];
            L2++;
          }
        }
        for (t = 1; t <= k + 1; t++) ll[t] = c[t];
        now = mid;
        o = 0;
        while (now <= Y2) {
          now = r[j][now];
          if (now <= Y2) p[++o] = now;
          if (o == k + 1) break;
        }
        L1 = 1;
        L2 = 1;
        for (t = 1; t <= k + 1; t++) {
          if (L1 <= k + 1 && (L2 > o || rr[L1] < p[L2])) {
            c[t] = rr[L1];
            L1++;
          } else {
            c[t] = p[L2];
            L2++;
          }
        }
        for (t = 1; t <= k + 1; t++) rr[t] = c[t];
        for (t = 0; t <= k; t++)
          ans += (long long)(ll[t] - ll[t + 1]) *
                 (long long)(rr[k - t + 1] - rr[k - t]);
      }
    }
  } else
    for (i = Y1; i <= Y2; i++) {
      for (j = 1; j <= 7; j++) ll[j] = X1 - 1, rr[j] = X2 + 1;
      ll[0] = mid;
      rr[0] = mid + 1;
      for (j = i; j <= Y2; j++) {
        now = mid + 1;
        o = 0;
        while (now >= X1) {
          now = U[now][j];
          if (now >= X1) p[++o] = now;
          if (o == k + 1) break;
        }
        L1 = 1;
        L2 = 1;
        for (t = 1; t <= k + 1; t++) {
          if (L1 <= k + 1 && (L2 > o || ll[L1] > p[L2])) {
            c[t] = ll[L1];
            L1++;
          } else {
            c[t] = p[L2];
            L2++;
          }
        }
        for (t = 1; t <= k + 1; t++) ll[t] = c[t];
        now = mid;
        o = 0;
        while (now <= X2) {
          now = D[now][j];
          if (now <= X2) p[++o] = now;
          if (o == k + 1) break;
        }
        L1 = 1;
        L2 = 1;
        for (t = 1; t <= k + 1; t++) {
          if (L1 <= k + 1 && (L2 > o || rr[L1] < p[L2])) {
            c[t] = rr[L1];
            L1++;
          } else {
            c[t] = p[L2];
            L2++;
          }
        }
        for (t = 1; t <= k + 1; t++) rr[t] = c[t];
        for (t = 0; t <= k; t++)
          ans += (long long)(ll[t] - ll[t + 1]) *
                 (long long)(rr[k - t + 1] - rr[k - t]);
      }
    }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (i = 0; i < n; i++) scanf("%s", s[i]);
  for (i = 1; i <= n; i++) {
    r[i][m + 1] = m + 1;
    for (j = 1; j <= m + 1; j++)
      if (j == 1 || s[i - 1][j - 2] == '0')
        l[i][j] = l[i][j - 1];
      else
        l[i][j] = j - 1;
    for (j = m; j >= 0; j--)
      if (j == m || s[i - 1][j] == '0')
        r[i][j] = r[i][j + 1];
      else
        r[i][j] = j + 1;
  }
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n + 1; j++)
      if (j == 1 || s[j - 2][i - 1] == '0')
        U[j][i] = U[j - 1][i];
      else
        U[j][i] = j - 1;
    D[n + 1][i] = n + 1;
    for (j = n; j >= 0; j--)
      if (j == n || s[j][i - 1] == '0')
        D[j][i] = D[j + 1][i];
      else
        D[j][i] = j + 1;
  }
  cdq(1, 1, n, m);
  cout << ans;
  return 0;
}
