#include <bits/stdc++.h>
const long double EPS = 1e-10;
const long long int MOD = 1000000007ll;
const long long int mod1 = 1000000009ll;
const long long int mod2 = 1100000009ll;
int INF = (int)1e9;
long long int INFINF = (long long int)1e18;
int debug = 0;
long double PI = acos(-1.0);
using namespace std;
long long int bit_count(long long int _x) {
  long long int _ret = 0;
  while (_x) {
    if (_x % 2 == 1) _ret++;
    _x /= 2;
  }
  return _ret;
}
long long int bit(long long int _mask, long long int _i) {
  return (_mask & (1 << _i)) == 0 ? 0 : 1;
}
long long int powermod(long long int _a, long long int _b,
                       long long int _m = MOD) {
  long long int _r = 1;
  while (_b) {
    if (_b % 2 == 1) _r = (_r * _a) % _m;
    _b /= 2;
    _a = (_a * _a) % _m;
  }
  return _r;
}
long long int add(long long int a, long long int b, long long int m = MOD) {
  long long int x = a + b;
  while (x >= m) x -= m;
  while (x < 0) x += m;
  return x;
}
long long int sub(long long int a, long long int b, long long int m = MOD) {
  long long int x = a - b;
  while (x < 0) x += m;
  while (x >= m) x -= m;
  return x;
}
long long int mul(long long int a, long long int b, long long int m = MOD) {
  long long int x = a * 1ll * b;
  x %= m;
  if (x < 0) x += m;
  return x;
}
int N, M, K;
int a[2510][2510];
int pref[2510][2510];
int b[2510][2510];
long long int ans = 0;
int sum(int x1, int y1, int x2, int y2) {
  return pref[x2][y2] - pref[x1 - 1][y2] - pref[x2][y1 - 1] +
         pref[x1 - 1][y1 - 1];
}
void solve(int x1, int y1, int x2, int y2) {
  if (x1 > x2 || y1 > y2) return;
  int n = x2 - x1 + 1;
  int m = y2 - y1 + 1;
  if (n == 1 && m == 1) {
    if (a[x1][y1] == K) ans++;
    return;
  }
  long long int curr = 0;
  if (m <= n) {
    int buff;
    int top, bottom;
    if (n % 2 == 0) {
      top = n / 2 + x1 - 1;
      bottom = n / 2 + x1;
    } else {
      top = n / 2 + x1 - 1;
      bottom = n / 2 + x1 + 1;
    }
    for (int l = y1; l <= y2; l++) {
      for (int r = l; r <= y2; r++) {
        int cnt1[7] = {0}, cnt2[7] = {0};
        if (n % 2 == 1)
          buff = sum(x1 + n / 2, l, x1 + n / 2, r);
        else
          buff = 0;
        if (buff > K) continue;
        int last = top;
        for (int k = 0; k <= K; k++) {
          if (last < x1) break;
          if (sum(last, l, top, r) > k) continue;
          int low, high, mid, idx;
          low = x1, high = last, idx = -1;
          while (low <= high) {
            mid = (low + high) >> 1;
            if (sum(mid, l, top, r) == k) {
              idx = mid;
              high = mid - 1;
            } else
              low = mid + 1;
          }
          cnt1[k] += last - idx + 1;
          last = idx - 1;
        }
        last = bottom;
        for (int k = 0; k <= K; k++) {
          if (last > x2) break;
          if (sum(bottom, l, last, r) > k) continue;
          int low, high, mid, idx;
          low = last, high = x2, idx = -1;
          while (low <= high) {
            mid = (low + high) >> 1;
            if (sum(bottom, l, mid, r) == k) {
              idx = mid;
              low = mid + 1;
            } else
              high = mid - 1;
          }
          cnt2[k] += idx - last + 1;
          last = idx + 1;
        }
        if (n % 2 == 0)
          for (int k = 0; k <= K; k++) curr += cnt1[k] * 1ll * cnt2[K - k];
        else {
          for (int k = 0; k <= K; k++)
            if (K - k - buff >= 0) curr += cnt1[k] * 1ll * cnt2[K - k - buff];
          if (K - buff >= 0) curr += cnt1[K - buff];
          if (K - buff >= 0) curr += cnt2[K - buff];
          if (buff == K) curr++;
        }
      }
    }
    ans += curr;
    solve(x1, y1, top, y2);
    solve(bottom, y1, x2, y2);
  } else {
    int buff;
    int left, right;
    if (m % 2 == 0) {
      left = m / 2 + y1 - 1;
      right = m / 2 + y1;
    } else {
      left = m / 2 + y1 - 1;
      right = m / 2 + y1 + 1;
    }
    for (int l = x1; l <= x2; l++) {
      for (int r = l; r <= x2; r++) {
        int cnt1[7] = {0}, cnt2[7] = {0};
        if (m % 2 == 1)
          buff = sum(l, m / 2 + y1, r, y1 + m / 2);
        else
          buff = 0;
        if (buff > K) continue;
        int last = left;
        for (int k = 0; k <= K; k++) {
          if (last < y1) break;
          if (sum(l, last, r, left) > k) continue;
          int low, high, mid, idx;
          low = y1, high = last, idx = -1;
          while (low <= high) {
            mid = (low + high) >> 1;
            if (sum(l, mid, r, left) == k) {
              idx = mid;
              high = mid - 1;
            } else
              low = mid + 1;
          }
          cnt1[k] += last - idx + 1;
          last = idx - 1;
        }
        last = right;
        for (int k = 0; k <= K; k++) {
          if (last > y2) break;
          if (sum(l, right, r, last) > k) continue;
          int low, high, mid, idx;
          low = last, high = y2, idx = -1;
          while (low <= high) {
            mid = (low + high) >> 1;
            if (sum(l, right, r, mid) == k) {
              idx = mid;
              low = mid + 1;
            } else
              high = mid - 1;
          }
          cnt2[k] += idx - last + 1;
          last = idx + 1;
        }
        if (m % 2 == 0)
          for (int k = 0; k <= K; k++) curr += cnt1[k] * 1ll * cnt2[K - k];
        else {
          for (int k = 0; k <= K; k++)
            if (K - k - buff >= 0) curr += cnt1[k] * 1ll * cnt2[K - k - buff];
          if (K - buff >= 0) curr += cnt1[K - buff];
          if (K - buff >= 0) curr += cnt2[K - buff];
          if (buff == K) curr++;
        }
      }
    }
    ans += curr;
    solve(x1, y1, x2, left);
    solve(x1, right, x2, y2);
  }
}
int main() {
  if (0) {
    freopen("input.txt", "r", stdin);
    debug = 1;
  }
  srand(time(NULL));
  cin >> N >> M >> K;
  for (int i = 1; i <= N; i++) {
    string s;
    cin >> s;
    for (int j = 1; j <= M; j++) a[i][j] = s[j - 1] - '0';
  }
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      pref[i][j] =
          a[i][j] + pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1];
  solve(1, 1, N, M);
  cout << ans;
  return 0;
}
