#include <bits/stdc++.h>   using namespace std;   const int inf = 1 << 28;   const double INF = 1e12, EPS = 1e-9;   int n, m, k;   bool star[600][600];   int sum[600][600];   char in[600][600];   void run() {     cin >> n >> m >> k;     for (int i = 0; i < n; i++) cin >> in[i];     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         if (in[i][j] ==  1  && in[i + 1][j] ==  1  && in[i + 2][j] ==  1  && j &&             in[i + 1][j - 1] ==  1  && in[i + 1][j + 1] ==  1 )           star[i][j] = 1;       }     long long ans = 0;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++)         sum[i + 1][j + 1] =             star[i][j] + sum[i][j + 1] + sum[i + 1][j] - sum[i][j];     for (int a = 0; a < n; a++)       for (int b = a + 3; b <= n; b++) {         int l = 0, r = 2, cnt = 0;         for (; l < m; l++) {           while (r <= m && cnt < k) {             r++;             cnt += sum[b - 2][r - 1] - sum[a][r - 1] -                    (sum[b - 2][r - 2] - sum[a][r - 2]);           }           if (cnt < k || r > m) break;           ans += m - r + 1;           cnt -= sum[b - 2][l + 2] - sum[a][l + 2] -                  (sum[b - 2][l + 1] - sum[a][l + 1]);         }       }     cout << ans << endl;   }   int main() { run(); }   