defmodule Main do
  use Bitwise

  def main do
    [h, w, k] = IO.gets("")
                |> String.split()
                |> Enum.map(&String.to_integer/1)
    board = IO.stream(:stdio, :line)
           |> Enum.take(h)
           |> Enum.map(&String.trim/1)
           |> Enum.map(&String.codepoints/1)

    board
    |> calc(h, w, k)
    |> IO.puts()

  end

  def calc(board, h, w, k) do
    Enum.reduce(0..(1<<<h)-1, 0, fn x, acc0 ->
      Enum.reduce(0..(1<<<w)-1, 0, fn y, acc1 ->
        Enum.reduce(0..h-1, 0, fn i, acc2 ->
          Enum.reduce(0..w-1, acc2, fn j, acc3 ->
            board
            |> at(i, j)
            |> count({x, y}, {i, j}, acc3)
          end)
        end)
        |> add(k)
        |> Kernel.+(acc1)
      end) + acc0
    end)
  end

  defguard is_valid(cell, x, y, i, j) when (x>>>i &&& 1) == 0 and (y>>>j &&& 1) == 0 and cell=="#"

  def count(cell, {x, y}, {i, j}, acc) when is_valid(cell, x, y, i, j), do: acc+1
  def count(_, _, _, acc), do: acc

  def at(board, i, j) do
    board
    |> Enum.at(i)
    |> Enum.at(j)
  end

  def add(sum, k) when sum == k, do: 1
  def add(_, _), do: 0

end
