M=10**9+7 m=512 n=read_line.to_i a=read_line.split.map(&.to_i) b=(0...m).map{|i|[0]*i} dp=[0]*n dp[0]=1 n.times{|i| (1...m).each{|x|dp[i]+=b[x][i% x]} if a[i]1 } p dp[n-1]