#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 100 + 5 ; 
const int M = 1e5 + 5 ; 
struct E {
	int to, next ; 
} e[M] ; 
int n, cnt, head[N], vis[N], D[N] ; 
char s[N] ; 
void add( int x, int y ) {
	e[++ cnt] = (E){ y, head[x] }, head[x] = cnt;
}
void dfs(int x) {
	if( vis[x] ) return ; 
	vis[x] = 1 ; 
	Next( i, x ) {
		int v = e[i].to ; 
		dfs(v) ; 
	}
}
signed main()
{
	n = gi() ; 
	rep( i, 1, n ) {
		scanf("%s", s + 1 ) ; 
		rep( j, 1, n ) if(s[j] == '1') add(i, j) ; 
	}
	rep( i, 1, n ) {
		rep( j, 1, n ) vis[j] = 0 ; 
		dfs(i) ; 
		rep( j, 1, n ) D[j] = D[j] + vis[j] ; 
	}
	long double ans = 0 ; 
	rep( i, 1, n ) ans = (ans + 1.0 / (1.0 * D[i])) ; 
	printf("%.12Lf\n", ans ) ; 
	return 0 ;
}
#include<bits/stdc++.h>
using namespace std;
typedef     long long    ll;
typedef     vector<int> vi;
typedef     vector<long long> vl;
typedef     pair<int, int>pi;
typedef     pair<long long, long long>pl;
#define F   first
#define S   second
#define pb  push_back
#define     all(x)      x.begin() , x.end()
#define mp  make_pair
#define       FOR(i,a,b) for(i=a;i<=b;i++)
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)
int main()
{
  ll n, i, m, x, y, j, k, mn = INT_MAX, ans = 0;
  cin >> n >> m;
  ll a[m + 3];
  a[0] = 0;
  for (i = 1; i <= m; i++)
  {
    cin >> a[i];
  }
  a[m + 1] = n + 1;
  vector<ll>v;
  sort(a, a + m + 2);
  for (i = 1; i <= m + 1; i++)
  {
    x = a[i] - a[i-1] - 1;
    if(x!=0)
    {
      v.pb(x);
    }
  }
  sort(all(v));
  if(v.size()==0) 
  {
    cout<<"0"<<endl;
    return 0;
  }
  mn=v[0];
  //cout<<mn<<endl;
  for (i = 0; i < v.size(); i++)
  {
    ans += ceil(double((v[i]*1.00) / mn));

  }
  cout << ans << endl;

}