// Rjesenje s minimalno memorije

#include <algorithm>
#include <cstdio>
#include <functional>
#include <queue>
#include <vector>

using namespace std;

typedef pair<int,int> par;

const int oo = 1000000000;

#define MAX 2500

int n;
char a[MAX][MAX+1];
int L[MAX], R[MAX], D[MAX+1];

int loga_sum;
int loga[MAX/2+1];
inline int query( int x ) { 
   int ret = 0;
   for( ++x; x > 0; x -= x&-x ) ret += loga[x];
   return ret;
}
inline void update( int x, int delta ) {
   loga_sum += delta;
   for( ++x; 2*x <= n; x += x&-x ) loga[x] += delta;
}

int main( void ) {
   scanf( "%d", &n );
   for( int i = 0; i < n; ++i ) scanf( "%s", a[i] );

   priority_queue< par, vector<par>, greater<par> > PQ;
   PQ.push( par(oo,oo) );

   for( int r = 0; r < n; ++r ) L[r] = R[r] = -1;

   int ret = 0;
   for( int c = 0; c < n; ++c ) {

      D[n] = -1;
      for( int r = n-1; r >= 0; --r ) {
         if( a[r][c] == '.' ) ++L[r]; else L[r] = -1;
         if( a[r][c] == '.' ) D[r] = D[r+1] + 1; else D[r] = -1;

         if( R[r] >= 0 ) --R[r]; 
         else if( a[r][c] == '.' ) for( R[r] = 0; a[r][c+R[r]+1] == '.'; ++R[r] );
      }

      for( int r2 = 0; r2 < 2; ++r2 ) {
         
         for( int i = 0; i*2 + r2 < n; ++i ) {
            int r = i*2 + r2;

            if( a[r][c] == '.' ) {
               ret += loga_sum - query( i-R[r]-1 );

               update( i, 1 );
               PQ.push( par( i + min( (int)L[r], D[r]/2 ), i ) );
            }
            
            for( ; PQ.top().first == i; PQ.pop() )
               update( PQ.top().second, -1 );            
         }
      }
   }

   printf( "%d\n", ret );
   
   return 0;
}
