package main

import "fmt"

func Sum(n []int) int {
	res := 0
	for i := 0; i < len(n); i++ {
		res += n[i]
	}
	return res
}
func main() {
	var N int
	fmt.Scan(&N)
	var A = make([]int, N)
	for i, _ := range A {
		fmt.Scan(&A[i])
	}

	ans := 0
	for i := 2; i <= N; i++ {
		for k := 0; k < i; k++ {
			for j := 0; j < N/i; j++ {
				if (j+1)*i+k < N+1 {
					if Sum(A[j*i+k:(j+1)*i+k]) == 0 {
						ans++
					}
				}
			}
		}
	}
	fmt.Println(ans)
}