main :: IO ()
main = do
    (h:w:k:_) <-  map read . words <$> getLine :: IO [Int]
    input <- coord h
    let permX = perm w
        permY = perm h
        ans   = count k $ [check input ys xs | xs <- permX, ys <- permY]
    print ans

coord :: Int -> IO [Bool]
coord 0 = pure []
coord n = (++) <$> convert <*> coord (n-1)
  where
    convert = map (== '#') <$> getLine

perm :: Int -> [[Bool]]
perm 1 = [[True],[False]]
perm n = (++) <$> map ((:) True) <*> map ((:) False) $ perm (n-1)

check :: [Bool] -> [Bool] -> [Bool] -> Int
check ls ms ns = sum $ map (\result -> if result then 1 else 0) $ zipWith (&&) ls $ intersection ms ns
  where
    intersection xs ys = [x && y | x <- xs, y <- ys]

count :: (Eq a) => a -> [a] -> Int
count x xs = sum $ change x xs
  where
    change x = map ((\m n -> if m == n then 1 else 0) x)
