#include <bits/stdc++.h>
using namespace std;
const int N = 2505;
using ll = long long;
int n, m, kk, a[N][N], sum[N][N], b[2][10];
char ch[N][N];
ll ans = 0;
inline int calc(int x1, int x2, int y1, int y2) {
  return sum[x2][y2] - sum[x1][y2] - sum[x2][y1] + sum[x1][y1];
}
void solve(int x1, int x2, int y1, int y2, int tp) {
  if (x1 == x2 || y1 == y2) return;
  if (x1 == x2 - 1 && y1 == y2 - 1) {
    ans += calc(x1, x2, y1, y2) == kk;
    return;
  }
  if (tp) {
    int mid = (x1 + x2) >> 1;
    solve(x1, mid, y1, y2, 0);
    solve(mid, x2, y1, y2, 0);
    for (int i = y1; i <= y2; i++) {
      b[0][0] = b[1][0] = mid;
      for (int j = 1; j <= kk + 1; j++) b[0][j] = x1, b[1][j] = x2;
      for (int j = i + 1; j <= y2; j++) {
        for (int k = 1; k <= kk + 1; k++)
          while (calc(b[0][k], mid, i, j) >= k) ++b[0][k];
        for (int k = 1; k <= kk + 1; k++)
          while (calc(mid, b[1][k], i, j) >= k) --b[1][k];
        for (int k = 0; k <= kk; k++)
          ans += ll(b[0][k] - b[0][k + 1]) * (b[1][kk - k + 1] - b[1][kk - k]);
      }
    }
  } else {
    int mid = (y1 + y2) >> 1;
    solve(x1, x2, y1, mid, 1);
    solve(x1, x2, mid, y2, 1);
    for (int i = x1; i <= x2; i++) {
      b[0][0] = b[1][0] = mid;
      for (int j = 1; j <= kk + 1; j++) b[0][j] = y1, b[1][j] = y2;
      for (int j = i + 1; j <= x2; j++) {
        for (int k = 1; k <= kk + 1; k++)
          while (calc(i, j, b[0][k], mid) >= k) ++b[0][k];
        for (int k = 1; k <= kk + 1; k++)
          while (calc(i, j, mid, b[1][k]) >= k) --b[1][k];
        for (int k = 0; k <= kk; k++)
          ans += ll(b[0][k] - b[0][k + 1]) * (b[1][kk - k + 1] - b[1][kk - k]);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> kk;
  for (int i = 1; i <= n; i++) cin >> (ch[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] + ch[i][j] - '0';
  solve(0, n, 0, m, 0);
  cout << ans << endl;
  return 0;
}
