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

C = []

for _ in range(h): C.append(eval(input()))

import itertools

ans = 0

for bit in range(1<<(h+w)):

    c = 0

    for i in range(h):

        for j in range(w):

            if bit>>(w+i) & 1 and bit>>j & 1: c += C[i][j] == '#'

    if c == k: ans += 1

print(ans)

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

C = []

for _ in range(h): C.append(eval(input()))

import itertools

ans = 0

for bit in range(1<<(h+w)):

    c = 0

    for i in range(w, h+w):

        for j in range(w):

            if bit>>i & 1 and bit>>j & 1: c += C[i-w][j] == '#'

    if c == k: ans += 1

print(ans)

h, w, k = list(map(int, input().split()))
C = []
for _ in range(h):
    C.append(eval(input()))
import itertools

ans = 0
for bit in range(1 << (h + w)):
    c = 0
    for i in range(h):
        for j in range(w):
            if bit >> (w + i) & 1 and bit >> j & 1:
                c += C[i][j] == "#"
    if c == k:
        ans += 1
print(ans)

h, w, k = list(map(int, input().split()))
C = []
for _ in range(h):
    C.append(eval(input()))
import itertools

ans = 0
for bit in range(1 << (h + w)):
    c = 0
    for i in range(w, h + w):
        for j in range(w):
            if bit >> i & 1 and bit >> j & 1:
                c += C[i - w][j] == "#"
    if c == k:
        ans += 1
print(ans)

-    for i in range(h): +    for i in range(w, h + w): -            if bit >> (w + i) & 1 and bit >> j & 1: -                c += C[i][j] == "#" +            if bit >> i & 1 and bit >> j & 1: +                c += C[i - w][j] == "#"