#include <bits/stdc++.h>
using namespace std;
inline long long getint() {
  long long num = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9') num = num * 10 + c - 48, c = getchar();
  return num * flag;
}
int n, m, K;
int a[2505][2505], up[2][2505];
long long ans;
int Num(int x1, int x2, int y1, int y2) {
  return a[x2][y2] - a[x1][y2] - a[x2][y1] + a[x1][y1];
}
void Solve(int x1, int x2, int y1, int y2, int type) {
  if (x1 == x2 || y1 == y2) return;
  if (x1 + 1 == x2 && y1 + 1 == y2) {
    if (Num(x1, x2, y1, y2) == K) ans++;
    return;
  }
  if (type == 1) {
    int mid = (x1 + x2) >> 1;
    Solve(x1, mid, y1, y2, 0);
    Solve(mid, x2, y1, y2, 0);
    for (int i = y1; i < y2; ++i) {
      up[0][0] = up[1][0] = mid;
      for (int j = 1; j <= K + 1; ++j) up[0][j] = x1, up[1][j] = x2;
      for (int j = i + 1; j <= y2; ++j) {
        for (int k = 1; k <= K + 1; ++k) {
          while (Num(up[0][k], mid, i, j) >= k) up[0][k]++;
          while (Num(mid, up[1][k], i, j) >= k) up[1][k]--;
        }
        for (int k = 0; k <= K; ++k)
          ans += 1ll * (up[0][k] - up[0][k + 1]) *
                 (up[1][K - k + 1] - up[1][K - k]);
      }
    }
  }
  if (type == 0) {
    int mid = (y1 + y2) >> 1;
    Solve(x1, x2, y1, mid, 1);
    Solve(x1, x2, mid, y2, 1);
    for (int i = x1; i < x2; ++i) {
      up[0][0] = up[1][0] = mid;
      for (int j = 1; j <= K + 1; ++j) up[0][j] = y1, up[1][j] = y2;
      for (int j = i + 1; j <= x2; ++j) {
        for (int k = 1; k <= K + 1; ++k) {
          while (Num(i, j, up[0][k], mid) >= k) up[0][k]++;
          while (Num(i, j, mid, up[1][k]) >= k) up[1][k]--;
        }
        for (int k = 0; k <= K; ++k)
          ans += 1ll * (up[0][k] - up[0][k + 1]) *
                 (up[1][K - k + 1] - up[1][K - k]);
      }
    }
  }
}
int main() {
  n = getint(), m = getint(), K = getint();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      char c;
      cin >> c;
      a[i][j] = c - 48;
      a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
    }
  Solve(0, n, 0, m, 0);
  printf("%lld\n", ans);
}
