#include <bits/stdc++.h>
using namespace std;
const int mx = 2505;
int n, m, K, sum[mx][mx], up[10], down[10];
long long ans;
char mat[mx][mx];
int calc(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] - sum[x1][y2] - sum[x2][y1] + sum[x1][y1];
}
void work(int x1, int y1, int x2, int y2, bool flag) {
  if (x1 == x2 || y1 == y2) return;
  if (x2 - x1 == 1 && y2 - y1 == 1) {
    ans += (calc(x1, y1, x2, y2) == K);
    return;
  }
  if (flag) {
    int mid = (x1 + x2) / 2;
    work(x1, y1, mid, y2, !flag);
    work(mid, y1, x2, y2, !flag);
    for (int i = y1; i < y2; i++) {
      up[0] = down[0] = mid;
      for (int j = 1; j <= K + 1; j++) up[j] = x1, down[j] = x2;
      for (int j = i + 1; j <= y2; j++) {
        for (int k = 1; k <= K + 1; k++) {
          while (calc(up[k], i, mid, j) >= k) up[k]++;
          while (calc(mid, i, down[k], j) >= k) down[k]--;
        }
        for (int k = 0; k <= K; k++)
          ans += (up[k] - up[k + 1]) * (down[K - k + 1] - down[K - k]);
      }
    }
  } else {
    int mid = (y1 + y2) / 2;
    work(x1, y1, x2, mid, !flag);
    work(x1, mid, x2, y2, !flag);
    for (int i = x1; i < x2; i++) {
      up[0] = down[0] = mid;
      for (int j = 1; j <= K + 1; j++) up[j] = y1, down[j] = y2;
      for (int j = i + 1; j <= x2; j++) {
        for (int k = 1; k <= K + 1; k++) {
          while (calc(i, up[k], j, mid) >= k) up[k]++;
          while (calc(i, mid, j, down[k]) >= k) down[k]--;
        }
        for (int k = 0; k <= K; k++)
          ans += (up[k] - up[k + 1]) * (down[K - k + 1] - down[K - k]);
      }
    }
  }
}
int main() {
  int T = 1;
  while (T--) {
    scanf("%d%d%d", &n, &m, &K);
    for (int i = 1; i <= n; i++) scanf("%s", mat[i] + 1);
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
        sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] +
                    (mat[i][j] - '0');
    ans = 0;
    work(0, 0, n, m, false);
    cout << ans << endl;
  }
  return 0;
}
