#define _GIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;


int main(void) {
    string S;
    cin >> S;

    int ans = 0;
    rep(i, 10) rep(j, 10) rep(k, 10) rep(l, 10) {
        vector<int> v(10, 0);
        v[i]++;
        v[j]++;
        v[k]++;
        v[l]++;
        bool ok = true;
        rep(m, v.size()) {
            if (v[m] > 0 && S[m] == 'x') ok = false;
            if (v[m] == 0 && S[m] == 'o') ok = false;
        }
        if (ok) ++ans;
    }

    cout << ans << endl;
    
    return 0;
}
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,d[105][105];
char s[105][105];

int main()
{
	n=read(); rep(i,1,n) scanf("%s",s[i]+1);
	rep(i,1,n) rep(j,1,n) d[i][j]=s[i][j]-'0';
	rep(k,1,n) rep(i,1,n) rep(j,1,n) if(d[i][k]&&d[k][j]) d[i][j]=1;
	double ans=0;
	rep(i,1,n)
	{
		int cnt=0;
		rep(j,1,n) if(d[j][i]&&j!=i) cnt++;
		ans+=1.0/(cnt+1);
	}
	printf("%.10lf\n",ans);
	return 0;
}