#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int MOD = 1e9 + 7;
const int N = 5e2 + 10;
const int dx[5] = {0, -1, 0, 1, 0}, dy[5] = {0, 1, 1, 1, 2};
int a[N][N], f[N][N] = {0}, n, m, k;
char s[N];
long long solve() {
  long long ans = 0;
  for (auto up = 1; up <= n; up++)
    for (auto down = up; down <= n; down++)
      for (int L = 1, R = 0, sum = 0; L <= m; L++) {
        while (R < m && sum < k) {
          R++;
          if (R > 2) sum += f[down - 1][R - 2] - f[up][R - 2];
        }
        if (sum >= k)
          ans += m - R + 1;
        else
          break;
        sum -= f[down - 1][L] - f[up][L];
      }
  return ans;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (auto i = 1; i <= n; i++) {
    scanf("\n%s", s);
    for (auto j = 1; j <= m; j++) a[i][j] = s[j - 1] - '0';
  }
  for (auto i = 1; i <= n; i++)
    for (auto j = 1; j <= m; j++) {
      for (auto k = 0; k <= 4; k++) f[i][j] += a[i + dx[k]][j + dy[k]];
      f[i][j] = (f[i][j] == 5);
    }
  for (auto j = 1; j <= m; j++)
    for (auto i = 1; i <= n; i++) f[i][j] += f[i - 1][j];
  cout << solve();
}
