#include <bits/stdc++.h>
using namespace std;
const int N = 2555;
const int K = 8;
char a[2][N][N];
int firstUp[2][N][N], firstDown[2][N][N];
int cnt[2][N][N];
int up[K], down[K];
int k;
int count(int t, int r, int i, int j) {
  return cnt[t][r][j] - cnt[t][r][i - 1];
}
int up_buffer[N];
int up_buffer_size;
int down_buffer[N];
int down_buffer_size;
void getUp(int t, int i, int j, int limit, int a[], int &size) {
  size = 0;
  for (i = firstUp[t][i][j]; size <= k; i = firstUp[t][i][j]) {
    a[size++] = i;
    if (i < limit) break;
  }
}
void getDown(int t, int i, int j, int limit, int a[], int &size) {
  size = 0;
  for (i = firstDown[t][i][j]; size <= k; i = firstDown[t][i][j]) {
    a[size++] = i;
    if (i > limit) break;
  }
}
bool decInt(const int &a, const int &b) { return a > b; }
int temp[N];
void rebuildBuffer(int buffer[], int &buffer_size, int more[], int more_size,
                   bool rev) {
  if (rev)
    merge(buffer, buffer + buffer_size, more, more + more_size, temp, decInt);
  else
    merge(buffer, buffer + buffer_size, more, more + more_size, temp);
  int temp_size =
      min((int)(unique(temp, temp + buffer_size + more_size) - temp), k + 2);
  memcpy(buffer, temp, sizeof(int) * temp_size);
  buffer_size = temp_size;
}
int saveUp[N][K], saveUp_size[N];
int saveDown[N][K], saveDown_size[N];
long long ans = 0;
void solve(int l, int r, int u, int d, int t) {
  if (l > r || u > d) return;
  if (r - l > d - u) return solve(u, d, l, r, !t);
  int mid = u + d >> 1;
  for (int i = l; i <= r; ++i) {
    getUp(t, mid, i, u, saveUp[i], saveUp_size[i]);
    getDown(t, mid + 1, i, d, saveDown[i], saveDown_size[i]);
  }
  for (int i = l; i <= r; ++i) {
    up_buffer_size = 1;
    up_buffer[0] = mid;
    down_buffer_size = 1;
    down_buffer[0] = mid + 1;
    for (int j = i; j <= r; ++j) {
      memset(up, 0, sizeof up);
      rebuildBuffer(up_buffer, up_buffer_size, saveUp[j], saveUp_size[j], 1);
      for (int p = 1, cur = count(t, up_buffer[0], i, j);
           p < up_buffer_size && cur <= k; ++p) {
        up[cur] += up_buffer[p - 1] - max(up_buffer[p], u - 1);
        if (up_buffer[p] < u) break;
        cur += count(t, up_buffer[p], i, j);
      }
      memset(down, 0, sizeof down);
      down[0] = 1;
      rebuildBuffer(down_buffer, down_buffer_size, saveDown[j],
                    saveDown_size[j], 0);
      for (int p = 1, cur = count(t, down_buffer[0], i, j);
           p < down_buffer_size && cur <= k; ++p) {
        down[cur] += min(down_buffer[p], d + 1) - down_buffer[p - 1];
        if (down_buffer[p] > d) break;
        cur += count(t, down_buffer[p], i, j);
      }
      for (int c = 0; c <= k; ++c) ans += up[c] * down[k - c];
    }
  }
  solve(l, r, u, mid - 1, t);
  solve(l, r, mid + 1, d, t);
}
void init(int t, int m, int n) {
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= n; ++j)
      cnt[t][i][j] = cnt[t][i][j - 1] + (a[t][i][j] == '1');
  for (int j = 1; j <= n; ++j) {
    firstUp[t][0][j] = 0;
    for (int i = 1; i <= m + 1; ++i)
      firstUp[t][i][j] = a[t][i - 1][j] == '1' ? (i - 1) : firstUp[t][i - 1][j];
    firstDown[t][m + 1][j] = m + 1;
    for (int i = m; i >= 0; --i)
      firstDown[t][i][j] =
          a[t][i + 1][j] == '1' ? (i + 1) : firstDown[t][i + 1][j];
  }
}
void _main() {
  int n, m;
  cin >> m >> n >> k;
  for (int i = 1; i <= m; ++i) cin >> a[0][i] + 1;
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= n; ++j) a[1][j][i] = a[0][i][j];
  init(0, m, n);
  init(1, n, m);
  solve(1, n, 1, m, 0);
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  clock_t start = clock();
  _main();
  clock_t stop = clock();
  return 0;
}
