#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18 + 5;
const int mod = (int)1e9 + 7;
const int logN = 17;
const int inf = 1e9;
const int N = 3001;
int U[9], D[9], L[9], R[9], n, m, k, DP[N][N], x, y, z, a[N][N];
long long ans;
char c;
inline int ask(int x, int x2, int y, int y2) {
  if (!x || !x2 || !y || !y2) return 0;
  return DP[x2][y2] - DP[x2][y - 1] - DP[x - 1][y2] + DP[x - 1][y - 1];
}
inline int take(int x, int x2, int y, int y2, int a) {
  int c2 = !a, cc = !a;
  cc += (L[a] - L[a + 1]);
  return cc;
}
inline int take2(int x, int x2, int y, int y2, int a) {
  int c2 = !a, cc = !a;
  cc += (R[a + 1] - R[a]);
  return cc;
}
inline int take3(int x, int x2, int y, int y2, int a) {
  int c2 = !a, cc = !a;
  cc += (U[a] - U[a + 1]);
  return cc;
}
inline int take4(int x, int x2, int y, int y2, int a) {
  int c2 = !a, cc = !a;
  cc += (D[a + 1] - D[a]);
  return cc;
}
void solve(int x, int x2, int y, int y2) {
  if (x > x2 || y > y2) return;
  int c = ans;
  if (x2 - x < y2 - y) {
    int mid = y + y2 >> 1;
    for (int i = x; i <= x2; i++) {
      for (int j = 0; j <= k + 1; j++) L[j] = y - 1, R[j] = y2 + 1;
      for (int j = i; j <= x2; j++) {
        for (int q = 0; q <= k + 1; q++) {
          while (L[q] < mid - 1 && ask(i, j, L[q] + 1, mid - 1) >= q) L[q]++;
          while (R[q] > mid + 1 && ask(i, j, mid + 1, R[q] - 1) >= q) R[q]--;
        }
        int need = k - ask(i, j, mid, mid);
        if (need < 0) break;
        for (int t = 0; t <= k; t++) {
          if (need - t < 0) break;
          ans += (long long)take(i, j, y, mid - 1, t) *
                 take2(i, j, mid + 1, y2, need - t);
        }
      }
    }
    solve(x, x2, y, mid - 1);
    solve(x, x2, mid + 1, y2);
  } else {
    int mid = x + x2 >> 1;
    for (int i = y; i <= y2; i++) {
      for (int j = 0; j <= k + 1; j++) U[j] = x - 1, D[j] = x2 + 1;
      for (int j = i; j <= y2; j++) {
        for (int q = 0; q <= k + 1; q++) {
          while (U[q] < mid - 1 && ask(U[q] + 1, mid - 1, i, j) >= q) U[q]++;
          while (D[q] > mid + 1 && ask(mid + 1, D[q] - 1, i, j) >= q) D[q]--;
        }
        int need = k - ask(mid, mid, i, j);
        if (need < 0) break;
        for (int t = 0; t <= k; t++) {
          if (need - t < 0) break;
          ans += (long long)take3(x, mid - 1, i, j, t) *
                 take4(mid + 1, x2, i, j, need - t);
        }
      }
    }
    solve(x, mid - 1, y, y2);
    solve(mid + 1, x2, y, y2);
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf(" %c", &c);
      DP[i][j] = a[i][j] = c - '0';
    }
  for (int i = 1; i <= n + 1; i++)
    for (int j = 1; j <= m + 1; j++)
      DP[i][j] += DP[i - 1][j] + DP[i][j - 1] - DP[i - 1][j - 1];
  solve(1, n, 1, m);
  cout << ans << '\n';
  return 0;
}
