from itertools import product

import sys

read = sys.stdin.read

def main():

    h, w, k = list(map(int, input().split()))

    c = []

    for _ in range(h):

        row = [c == '#' for c in list(eval(input()))]

        c.append(row)

    r = 0

    p1 = tuple(product((0, 1), repeat=w))

    p2 = tuple(product((0, 1), repeat=h))

    pat = tuple(product(p1, p2))

    for pe in pat:

        t = 0

        for x, col in enumerate(pe[0]):

            for y, row in enumerate(pe[1]):

                t += col * row * c[y][x]

        if t == k:

            r += 1

    print(r)

if __name__ == '__main__':

    main()
import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

from itertools import product

def main():

    h, w, k = list(map(int, input().split()))

    gg = []

    for _ in range(h):

        row = [1 if c == '#' else 0 for c in list(eval(input()))]

        gg.extend(row)

    row_pro = tuple(product((0, 1), repeat=h))

    col_pro = tuple(product((0, 1), repeat=w))

    rows = []

    for re in row_pro:

        rows.append([i for i, b in enumerate(re) if b])

    cols = []

    for ce in col_pro:

        cols.append([i for i, b in enumerate(ce) if b])

    pat = tuple(product(rows, cols))

    r = 0

    for pate in pat:

        t0 = 0

        for p0 in pate[0]:

            for p1 in pate[1]:

                t0 += gg[p0*w + p1]

        if t0 == k:

            r += 1

    print(r)



if __name__ == '__main__':

    main()

from itertools import product
import sys

read = sys.stdin.read


def main():
    h, w, k = list(map(int, input().split()))
    c = []
    for _ in range(h):
        row = [c == "#" for c in list(eval(input()))]
        c.append(row)
    r = 0
    p1 = tuple(product((0, 1), repeat=w))
    p2 = tuple(product((0, 1), repeat=h))
    pat = tuple(product(p1, p2))
    for pe in pat:
        t = 0
        for x, col in enumerate(pe[0]):
            for y, row in enumerate(pe[1]):
                t += col * row * c[y][x]
        if t == k:
            r += 1
    print(r)


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from itertools import product


def main():
    h, w, k = list(map(int, input().split()))
    gg = []
    for _ in range(h):
        row = [1 if c == "#" else 0 for c in list(eval(input()))]
        gg.extend(row)
    row_pro = tuple(product((0, 1), repeat=h))
    col_pro = tuple(product((0, 1), repeat=w))
    rows = []
    for re in row_pro:
        rows.append([i for i, b in enumerate(re) if b])
    cols = []
    for ce in col_pro:
        cols.append([i for i, b in enumerate(ce) if b])
    pat = tuple(product(rows, cols))
    r = 0
    for pate in pat:
        t0 = 0
        for p0 in pate[0]:
            for p1 in pate[1]:
                t0 += gg[p0 * w + p1]
        if t0 == k:
            r += 1
    print(r)


if __name__ == "__main__":
    main()

-from itertools import product +readline = sys.stdin.readline +readlines = sys.stdin.readlines +from itertools import product -    c = [] +    gg = [] -        row = [c == "#" for c in list(eval(input()))] -        c.append(row) +        row = [1 if c == "#" else 0 for c in list(eval(input()))] +        gg.extend(row) +    row_pro = tuple(product((0, 1), repeat=h)) +    col_pro = tuple(product((0, 1), repeat=w)) +    rows = [] +    for re in row_pro: +        rows.append([i for i, b in enumerate(re) if b]) +    cols = [] +    for ce in col_pro: +        cols.append([i for i, b in enumerate(ce) if b]) +    pat = tuple(product(rows, cols)) -    p1 = tuple(product((0, 1), repeat=w)) -    p2 = tuple(product((0, 1), repeat=h)) -    pat = tuple(product(p1, p2)) -    for pe in pat: -        t = 0 -        for x, col in enumerate(pe[0]): -            for y, row in enumerate(pe[1]): -                t += col * row * c[y][x] -        if t == k: +    for pate in pat: +        t0 = 0 +        for p0 in pate[0]: +            for p1 in pate[1]: +                t0 += gg[p0 * w + p1] +        if t0 == k: