#include <iostream>
#include <algorithm>

int main() {
    int n, m, k;
    std::cin >> n >> m >> k;

    char a[110][110];

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            std::cin >> a[i][j];
        }
    }

    int cnt[110] = { 0 };
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if (a[i][j] == 'B')
                ++cnt[j];
        }
    }

    std::sort(cnt, cnt + m);
    for (int j = 0; j < m; ++j) {
        while (k > 0 && cnt[j] > 0) {
            --k;
            --cnt[j];
        }
    }

    int ans = 0;
    for (int j = 0; j < m; ++j) {
        if (cnt[j] == 0)
            ++ans;
    }

    std::cout << ans;
}