import           Control.Monad

type Matrix = [[Char]]
type Pattern = [Bool]

patterns :: Int -> [Pattern]
patterns n = do
    start <- return []
    foldr (<=<)
        return
        (replicate n (\x -> map (:x) [True, False]))
     start

fill :: Matrix -> Pattern -> Matrix
fill [] _          = []
fill (x:xs) (y:ys)
  | y         = replicate (length x) 'R':(fill xs ys)
  | otherwise = x:(fill xs ys)

swap :: Matrix -> Matrix
swap ([]:_) = []
swap line   = foldr (\x acc -> head x : acc) [] line : (swap . map tail) line

main :: IO ()
main = do
    [h, w, k] <- map read . words <$> getLine
    matrix <-  lines . filter (/=',') <$> getContents
    let matrix' = return matrix
                >>= (\m -> map (fill m) (patterns h))
                >>= (\m -> map (fill $ swap m) (patterns w))
    print $ length . filter (==k) $ map (length . filter (=='#')) $ map concat matrix'
