Problem:
Score : 300 points

Problem Statement

We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is ., and black if c_{i,j} is #.

Consider doing the following operation:

Choose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.

You are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.

Constraints

1 \leq H, W \leq 6

1 \leq K \leq HW

c_{i,j} is . or #.

Input

Input is given from Standard Input in the following format:

H W K
c_{1,1}c_{1,2}...c_{1,W}
c_{2,1}c_{2,2}...c_{2,W}
:
c_{H,1}c_{H,2}...c_{H,W}

Output

Print an integer representing the number of choices of rows and columns satisfying the condition.

Sample Input 1

2 3 2
..#
###

Sample Output 1

5

Five choices below satisfy the condition.

The 1-st row and 1-st column

The 1-st row and 2-nd column

The 1-st row and 3-rd column

The 1-st and 2-nd column

The 3-rd column

Sample Input 2

2 3 4
..#
###

Sample Output 2

1

One choice, which is choosing nothing, satisfies the condition.

Sample Input 3

2 2 3
##
##

Sample Output 3

0

Sample Input 4

6 6 8
..##..
.#..#.
#....#
######
#....#
#....#

Sample Output 4

208

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;

typedef long long int          ll;
typedef set<int>               si;
typedef pair<int,int>          pii;
typedef pair<ll,ll>            pll;
typedef vector<int>            vi;
typedef vector<ll>             vll;
typedef vector<vll>            vvl;
typedef map<int,int>           mi;
typedef map<ll,ll>             mll; 

/*.................................................................................................................................*/

#define mod                    1000000007
#define nl                     "\n";
#define ff                     first 
#define ss                     second
#define mp                     make_pair
#define pb                     push_back
#define sz(a)                  (int)a.size()
#define fi(a,b)                for(ll i=a;i<b;i++)
#define fj(a,b)                for(ll j=a;j<b;j++)
#define fri(a,b)               for(ll i=a;i>=b;i--)
#define frj(a,b)               for(ll j=a;j>=b;j--)
#define all(v)                 (v).begin(),(v).end()
#define mem(v,a)               memset((v),a,sizeof(v))
#define show(v)                for(auto i:v)cout<<i<<" ";cout<<nl; 
#define fast                   ios_base::sync_with_stdio(false);cin.tie(NULL);

/*.................................................................................................................................*/

inline ll add(ll a, ll b)      {a += b ;return a >= mod ? a - mod : a ;}
inline ll sub(ll a, ll b)      {a -= b ;return a < 0 ? a + mod : a ;}
inline ll mul(ll a, ll b)      {return (ll)a * b % mod ;}
inline ll power(ll a,ll n)     {ll res=1;while(n){if(n&1){res=mul(res,a);} n>>=1,a=mul(a,a);}return res;}
inline ll sum(ll n)            {ll sum=n;if(sum%2==0){sum=sum>>1;sum*=(n+1);}else sum*=((n+1)/2);return sum;}

/*.....................................................CODE_STARTS.................................................................*/
int prime[1000005];
void solve(){
	int r,c,k,b=0;
	fi(0,r)
		fi(0,c){
			char c;cin>>c;
			if(c=='#');
			else b++;
		}
	cout<<max(0,b-k);
}
int main(){
    fast
    int t=1;
    //cin>>t;
    while(t--){
       solve();if(t!=0)cout<<endl;
    }
    return 0;
}