#include<bits/stdc++.h>
#define ll              long long int
#define ld              long double
#define ff              first
#define ss              second
#define mod             1000000007
#define ull             unsigned long long
#define vll             vector<ll>
#define uom             unordered_map
#define uos             unordered_set
#define pll             pair<ll, ll>
#define INF             9223372036854775807
#define w(t)            ll tests;    cin>>tests;        while(tests--)
#define endl            "\n"
#define pb(x)           push_back(x)
#define ppb()			pop_back()
#define all(x)          x.begin(), x.end()
#define mp(a, b)        make_pair(a, b)
#define setp(x, y)      fixed << setprecision(x) << y
#define f(i, a, b)      for(ll i = a ; i < b ; i++)
#define fo(j, a, b)     for(ll j = a ; j >= b ; j--)
#define fill(a, n, x)   f(i, 0, n)     a[i]=x;
using namespace std;

void init() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int main() {

	init();
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	ll n;
	cin >> n;
	ll a[200] = {0};

	f(i, 0, n)
	{
		ll x;
		cin >> x;
		a[x % 200]++;
	}

	ll ans = 0;
	f(i, 0, 200)
	ans += a[i] * (a[i] - 1) / 2;

	cout << ans;

	return 0;
}
#include "bits/stdc++.h"
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef __int128 lll;
typedef vector<int> vi;
typedef vector<ll> vl;
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const ll inf=0x3f3f3f3f3f3f3f3f;
const int mn=101;
const ll mod=998244353;

string g[mn];
bool vis[mn];
int n;
void dfs(int x){
    vis[x]=1;
    for(int y=0;y<n;y++)if(!vis[y]&&g[y][x]=='1'){
        dfs(y);
    }
}
int main(){
#ifdef LOCAL
    freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
freopen("error.txt","w",stderr);
#endif
    cin.tie(0);
    cin.sync_with_stdio(0);
    cin>>n;
    for(int i=0;i<n;i++)cin>>g[i];
    double ans=0;
    for(int i=0;i<n;i++){
        memset(vis,0,sizeof(vis));
        dfs(i);
        int num=0;
        for(int j=0;j<n;j++)num+=vis[j];
        //cerr<<num<<endl;
        ans+=1./num;
    }
    printf("%.20lf\n",ans);
    return 0;
}