#include<bits/stdc++.h>
using namespace std;
//typedef long long int lld;
using lld=long long int;

int main(){
    ios_base::sync_with_stdio(0); 
	cin.tie(NULL); 
	cout.tie(NULL);
	
	lld n,ans=0;
	cin>>n;
	lld a[n];
	map<lld,lld>m;
	for(int i=0;i<n;i++){
		cin>>a[i];
		m[a[i]%200]++;
	}
	for(auto i:m)
		ans+=((i.second)*(i.second-1))/2;
	cout<<ans<<endl;

	return 0;	
}
#include <bits/stdc++.h>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

#define MOD 1000000007

int mpow(int a, int b) {
	int res = 1;
	for (; b; b >>= 1) {
		if (b & 1) res = (int64_t) res * a % MOD;
		a = (int64_t) a * a % MOD;
	}
	return res;
}

#ifdef WIN32
#define getchar_fast getchar
#else
#define getchar_fast getchar_unlocked
#endif

int main() {
	int h = ri();
	int w = ri();
	std::vector<bool> a[h];
	getchar_fast();
	for (auto &i : a) {
		i.resize(w);
		for (int j = 0; j < w; j++) i[j] = getchar_fast() == '.';
		getchar_fast();
	}
	
	int16_t free[h][w];
	memset(free, 0, sizeof(free));
	for (int i = 0; i < h; i++) {
		int start = 0;
		for (int j = 0; j <= w; j++) if (j == w || !a[i][j]) {
			for (int k = start; k < j; k++) free[i][k] += j - start;
			start = j + 1;
		}
	}
	for (int i = 0; i < w; i++) {
		int start = 0;
		for (int j = 0; j <= h; j++) if (j == h || !a[j][i]) {
			for (int k = start; k < j; k++) free[k][i] += j - start;
			start = j + 1;
		}
	}
	
	int k = 0;
	for (auto &i : a) k += std::accumulate(i.begin(), i.end(), 0);
	int b2[h + w];
	b2[0] = 1;
	int b2_rev[h + w];
	b2_rev[0] = mpow(2, k);
	for (int i = 1; i < h + w; i++) {
		b2[i] = b2[i - 1] + b2[i - 1];
		if (b2[i] >= MOD) b2[i] -= MOD;
		b2_rev[i] = (int64_t) b2_rev[i - 1] * 500000004 % MOD;
	}
	
	
	int res = 0;
	for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) {
		if (!a[i][j]) continue;
		// std::cerr << free[i][j] - 1 << std::endl;
		res = (res + (int64_t) (b2[free[i][j] - 1] - 1 + MOD) * b2_rev[free[i][j] - 1]) % MOD;
	}
	std::cout << res << std::endl;
	
	return 0;
}

