#include <bits/stdc++.h>
using namespace std;
int n, m, t, now;
char z;
long long ans, tmp;
int a[600][600], s[600][600];
int main() {
  cin >> n >> m >> t;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> z;
      if (z == '1')
        a[i][j] = 1;
      else
        a[i][j] = 0;
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
      if ((i > 2) && (j > 2) && (a[i][j - 1] == 1) && (a[i - 1][j - 2] == 1) &&
          (a[i - 1][j - 1] == 1) && (a[i - 1][j] == 1) &&
          (a[i - 2][j - 1] == 1))
        ++s[i][j];
    }
  }
  for (int i = 3; i <= n; i++)
    for (int j = 3; j <= m; j++) {
      now = m;
      tmp = (n - i + 1) * (m - j + 1);
      for (int k = i; k <= n; k++) {
        if (now > m) now = m;
        while ((now >= j) &&
               (s[k][now] - s[k][j - 1] - s[i - 1][now] + s[i - 1][j - 1] >= t))
          --now;
        if (now <= m) ++now;
        tmp -= now - j;
      }
      ans += tmp;
    }
  cout << ans << endl;
  return 0;
}
