#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0, 0};
const int dy[] = {0, 1, 0, -1, 0};
int n, m, k, isStar[555][555], row[555][555], s[555];
string a[555];
long long ans;
int main() {
  cin >> m >> n >> k;
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 1; i <= m - 2; i++)
    for (int j = 1; j <= n - 2; j++) {
      isStar[i][j] = 1;
      for (int z = 0; z < 5; z++)
        isStar[i][j] &= (a[i - dx[z]][j - dy[z]] == '1');
    }
  m -= 2;
  n -= 2;
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++) row[i][j] = row[i][j - 1] + isStar[i][j];
  for (int l = 0; l <= n - 1; l++)
    for (int r = l + 1; r <= n; r++)
      for (int i = 1, j = 0; i <= m; i++) {
        s[i] = s[i - 1] + row[i][r] - row[i][l];
        while (s[i] - s[j] >= k) j++;
        ans += j;
      }
  cout << ans << endl;
}
