#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<string> S(N);
    REP(i, 0, N) cin >> S[i];

    vector<vector<bool>> d(N, vector<bool>(N, false));
    REP(i, 0, N) REP(j, 0, N) if (S[i][j] == '1') d[i][j] = true;
    REP(k, 0, N) REP(i, 0, N) REP(j, 0, N) if (d[i][k] && d[k][j]) d[i][j] = true;

    double ans = 0;
    REP(i, 0, N) {
        int cnt = 0;
        REP(j, 0, N) {
            if (i == j || d[j][i]) cnt++;
        }
        ans += (double)(1) / cnt;
    }
    cout << fixed << setprecision(15);
    cout << ans << endl;
    return 0;
}
#include <bits/stdc++.h>
typedef double          D;
typedef long long int   LL;
typedef long double     LD;
#define OR              ||
#define AND             &&
#define nl              '\n'
#define ff              first
#define ss              second
#define S               string
#define inf             INT_MAX
#define SQR(a)          (a) * (a)
#define pb              push_back
#define GCD(a, b)       __gcd(a, b)
#define PI              2.0*acos(0.0)
#define pii             pair<int,int>
#define pll             pair<long long,long long>
#define LCM(a, b)       (a * b) / GCD(a, b)
#define mem(a,b)        memset(a,b,sizeof(a))
#define srtv(v)         sort(v.begin(),v.end())
#define T               int t; cin>>t; while(t--)
#define Rep(i,a,b)      for(int i = a; i <= b; i++)
#define rep(i,a,b)      for(int i = a; i >= b; i--)
#define boost           ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inout           freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)

#define si(x)           scanf("%d",&x)
#define pi(x)           printf("%d",x)
#define sss(str)         scanf("%s",str)
#define pl(x)           printf("%lld",x)
#define sl(x)           scanf("%lld",&x)
#define sii(x,y)        scanf("%d %d",&x,&y)
#define sll(x,y)        scanf("%lld %lld",&x,&y)
#define siii(x,y,z)     scanf("%d %d %d",&x,&y,&z)
#define slll(x,y,z)     scanf("%lld %lld %lld",&x,&y,&z)
using namespace std;

/*
int bs(int l,int r,int n)
{
    int mid,res=inf;

    while(l<=r)
    {
        mid=l+(r-l)/2;

        if(check(mid,n))
        {
            r=mid-1;
            res=min(res,mid);
        }
        else
            l=mid+1;

    }

    return res;
}
*/


//--------------------------code starts here---------------------------------------
int L;

unsigned long long dp[205][13];

unsigned long long func(int pos,int taken)
{
    if(taken==11)
    {
        return 1;
    }

    if(pos==L)
        return 0;
    if(dp[pos][taken]!=-1)
        return dp[pos][taken];

    return dp[pos][taken]=func(pos+1,taken)+func(pos+1,taken+1);
}

int main()
{
    cin>>L;
    mem(dp,-1);
    cout<<func(1,0)<<nl;


	return 0;
}