#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, b, n) for (int i = (b); i < (n); i++)
using namespace std;
using ll = long long;
const ll M = 998244353;

int main() {
	int h, w;
	string s[101];
	int ans = 0;
	cin >> h >> w;
	rep(i, h) cin >> s[i];

	int cnt = 0;
	rep(i, h) {
		rep(j, w) {
			if (s[i][j] == '.') cnt++;
			if (s[i][j] == '#') {
				ans += max(cnt - 1, 0);
				cnt = 0;
			}
		}
		ans += max(cnt - 1, 0);
		cnt = 0;
	}
	rep(i, w) {
		rep(j, h) {
			if (s[j][i] == '.') cnt++;
			if (s[j][i] == '#') {
				ans += max(cnt - 1, 0);
				cnt = 0;
			}
		}
		ans += max(cnt - 1, 0);
		cnt = 0;
	}
	cout << ans << endl;
}
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define ll long long
int main(){
  ll n;
  cin>>n;
  vector<int> v;
  rep(i,n){
    int a;
    cin>>a;
    v.push_back(a);
  }
  sort(v.begin(),v.end());
  ll ans=n*(n-1)/2;
  ll num=1;
  rep(i,n-1){
    if(v[i]==v[i+1]){
      ++num;
    }else{
      ans-=num*(num-1)/2;
      num=1;
    }
  }
  ans-=num*(num-1)/2;
  cout<<ans<<endl;
  return 0;
}