#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[510][510], b[510][510] = {}, s[510][510] = {};
int calc(int x1, int y1, int x2, int y2) {
  if (x2 - x1 < 2 || y2 - y1 < 2) return 0;
  return s[x2 - 1][y2 - 1] - s[x2 - 1][y1] - s[x1][y2 - 1] + s[x1][y1];
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++)
      if (s[j] == '1')
        a[i][j] = 1;
      else
        a[i][j] = 0;
  }
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++)
      if (a[i][j] && a[i + 1][j] && a[i - 1][j] && a[i][j + 1] && a[i][j - 1])
        b[i][j] = 1;
  for (int i = 1; i < n; i++)
    for (int j = 1; j < m; j++)
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + b[i][j];
  long long col = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      int l, r = 0;
      for (l = 0; l < m; l++) {
        while (r + 1 < m && calc(i, l, j, r) < k) {
          r++;
        }
        if (calc(i, l, j, r) >= k) {
          col += m - r;
        }
      }
    }
  }
  cout << col;
}
