#include <algorithm>
#include <iostream>
#include <vector>

int
main()
{
    std::ios::sync_with_stdio(false);
    std::size_t h;
    std::size_t w;
    std::size_t k;
    std::cin >> h;
    std::cin >> w;
    std::cin >> k;
    std::vector<std::vector<char>> grid;
    grid.resize(h);
    for (std::size_t row = 0; row<h; ++row)
    {
        std::string columns;
        std::cin >> columns;
        grid[row] = std::vector<char>(columns.begin(), columns.end());
    }

    std::vector<int> rowBlackCounts(h);
    std::vector<int> colBlackCounts(w);

    int totalBlockCount = 0;

    for (std::size_t row = 0; row<h; ++row)
    {
        int rowCount = 0;
        for (std::size_t col = 0; col<w; ++col)
        {
            if (grid[row][col]=='#')
            {
                ++rowCount;
                ++totalBlockCount;
            }
        }
        rowBlackCounts[row] = rowCount;
    }

    for (std::size_t col = 0; col<w; ++col)
    {
        int colCount = 0;
        for (std::size_t row = 0; row<h; ++row)
        {
            if (grid[row][col]=='#')
            {
                ++colCount;
            }
        }
        colBlackCounts[col] = colCount;
    }

    int solutionCount = 0;

    for (std::size_t rowChooseCount = 0; rowChooseCount<h+1; ++rowChooseCount)
    {
        std::vector<bool> rowPowerSet(h-rowChooseCount, 0);
        rowPowerSet.resize(h, 1);
        std::sort(rowPowerSet.begin(), rowPowerSet.end());

        do
        {
            for (std::size_t colChooseCount = 0; colChooseCount<w+1; ++colChooseCount)
            {
                std::vector<bool> colPowerSet(w-colChooseCount, 0);
                colPowerSet.resize(w, 1);
                std::sort(colPowerSet.begin(), colPowerSet.end());

                do
                {
                    int reduceCount = 0;
                    for (std::size_t row = 0; row<h; ++row)
                    {
                        if (rowPowerSet[row])
                        {
                            reduceCount += rowBlackCounts[row];
                        }
                    }

                    for (std::size_t col = 0; col<w; ++col)
                    {
                        if (colPowerSet[col])
                        {
                            reduceCount += colBlackCounts[col];
                        }
                    }

                    for (std::size_t row = 0; row<h; ++row)
                    {
                        for (std::size_t col = 0; col<w; ++col)
                        {
                            if (rowPowerSet[row]&&colPowerSet[col]&&grid[row][col]=='#')
                            {
                                reduceCount -= 1;
                            }
                        }
                    }

                    if (totalBlockCount-reduceCount==static_cast<int>(k))
                    {
                        ++solutionCount;
                    }

                } while (std::next_permutation(colPowerSet.begin(), colPowerSet.end()));
            }
        } while (std::next_permutation(rowPowerSet.begin(), rowPowerSet.end()));
    }

    std::cout << solutionCount << "\n";

    return 0;
}


Measured memory_bytes: 3652