#include <bits/stdc++.h>
using namespace std;
const int maxn = 2507;
int n, m, k, a[maxn][maxn], f[maxn][maxn];
int up[2][9];
long long ans;
void read() {
  char ch;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      ch = getchar();
      while (ch < '0' || ch > '9') ch = getchar();
      a[i][j] = ch - '0';
    }
  }
}
int query(int x1, int y1, int x2, int y2) {
  return f[x2][y2] - f[x1][y2] - f[x2][y1] + f[x1][y1];
}
void solve(int xl, int xr, int yl, int yr, int type) {
  if (xl == xr || yl == yr) return;
  if (xl == xr - 1 && yl == yr - 1) {
    ans += (query(xl, yl, xr, yr) == k);
    return;
  }
  if (type) {
    int mid = (xl + xr) >> 1;
    solve(xl, mid, yl, yr, 0);
    solve(mid, xr, yl, yr, 0);
    for (int i = yl; i <= yr; i++) {
      up[0][0] = up[1][0] = mid;
      for (int j = 1; j <= k + 1; j++) up[0][j] = xl, up[1][j] = xr;
      for (int j = i + 1; j <= yr; j++) {
        for (int t = 1; t <= k + 1; t++) {
          while (query(up[0][t], i, mid, j) >= t) up[0][t]++;
          while (query(mid, i, up[1][t], j) >= t) up[1][t]--;
        }
        for (int t = 0; t <= k; t++) {
          ans += 1ll * (up[0][t] - up[0][t + 1]) *
                 (up[1][k - t + 1] - up[1][k - t]);
        }
      }
    }
  } else {
    int mid = (yl + yr) >> 1;
    solve(xl, xr, yl, mid, 1);
    solve(xl, xr, mid, yr, 1);
    for (int i = xl; i <= xr; i++) {
      up[0][0] = up[1][0] = mid;
      for (int j = 1; j <= k + 1; j++) up[0][j] = yl, up[1][j] = yr;
      for (int j = i + 1; j <= xr; j++) {
        for (int t = 1; t <= k + 1; t++) {
          while (query(i, up[0][t], j, mid) >= t) up[0][t]++;
          while (query(i, mid, j, up[1][t]) >= t) up[1][t]--;
        }
        for (int t = 0; t <= k; t++) {
          ans += 1ll * (up[0][t] - up[0][t + 1]) *
                 (up[1][k - t + 1] - up[1][k - t]);
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  read();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++)
      f[i][j] = f[i - 1][j] + f[i][j - 1] - f[i - 1][j - 1] + a[i][j];
  }
  solve(0, n, 0, m, 0);
  printf("%I64d", ans);
  return 0;
}
