package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt64() (int64, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := int64(1), int64(0)
	if ch == '-' {
		neg = -1
	} else {
		val = int64(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int64(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func (s *scanner) ReadInt() (int, error) {
	v, err := s.ReadInt64()
	return int(v), err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int64, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt64()
	}
	// fmt.Printf("n=%d\n", n)
	sa, s := int64(0), int64(0)
	for i := 0; i < n-1; i++ {
		sa += int64(a[i])
		s += sa
	}
	// if n == 200000 {
	// 	fmt.Printf("sa=%d,s=%d\n", sa, s)
	// }
	a1 := (int64(n)*int64(n+1)/2 - s) / int64(n)
	if a1 < 1 || a1 > int64(n) {
		fmt.Println("-1")
		return
	}
	b := make([]int64, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] < 1 || b[i+1] > int64(n) || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader = bufio.NewReader(os.Stdin)
var writer = bufio.NewWriter(os.Stdout)
func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{}) { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()
	var n int
	scanf("%d\n", &n)
	a := make([]int64, n - 1)
	for i := 0; i < n - 1; i++ {
		scanf("%v", &a[i])
	}
	ans := make([]int64, n)
	var mn int64 = 0
	for i := 1; i < n; i++ {
		ans[i] = ans[i - 1] + a[i - 1]
		mn = min(mn, ans[i])
	}
	for i := 0; i < n; i++ {
		ans[i] -= mn
	}
	yes := true

	b := make([]bool, n)
	for i := 0; i < n; i++ {
		if ans[i] >= int64(n) || b[ans[i]] {
			yes = false
			break
		}
		b[ans[i]] = true
	}

	if yes {
		for i := 0; i < n; i++ {
			printf("%v ", ans[i] + 1)
		}
	} else {
		printf("-1\n")
	}
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

// Codeforces 1141 C Polycarp Restores Permutation train TODO
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j:=0; j<n; j++ {
		aa,err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n int
var q []int
var res []int

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n, k
	n, _, _, _, _ = readFive()
	// reading b
	q = readLineNumbs(n-1)
}

func solve() {
	p := make([]int, n)
	p[0] = 0
	minp := 0
	for i:=1; i<n; i++ {
		p[i] = p[i-1] + q[i-1]
		if p[i] < minp {
			minp = p[i]
		}
	}
	// fmt.Println("p: ", p, " minp= ", minp)
	// make minp 1 and raise all others
	for i:=0; i<n; i++ {
		p[i] = p[i] + (1 - minp)
	}
	// check all numbers one time
	cnts := make([]int, n+1)
	perm := true
	for i:=0; i<n; i++ {
		if p[i]<1 || p[i]>n {
			perm = false
			break
		}
		cnts[p[i]] ++
	}
	// check all cnts = 1
	for i:=1; i<=n; i++ {
		if cnts[i] != 1 {
			perm = false
			break
		}
	}
	if perm {
		res = p
	} else {
		res = make([]int, 1)
		res[0] = -1
	}
}

func printRes() {
	for i:=0; i<len(res); i++ {
		fmt.Print(res[i]," ")
	}
	fmt.Println("")
}

func main() {
	readData()
	solve()
	printRes()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscanf(reader, "%d\n", &n)

	var mn, mx int64 = 0, 0
	arr := make([]int64, n)
	used := make(map[int64]bool)

	used[0] = true

	for i := 1; i < n; i++ {
		fmt.Fscanf(reader, "%d ", &arr[i])
		arr[i] = arr[i] + arr[i-1]
		mn = min(mn, arr[i])
		mx = max(mx, arr[i])

		if mx+absIs(mn) > int64(n) || used[arr[i]] {
			fmt.Println(-1)
			return
		}

		used[arr[i]] = true
	}

	for _, vl := range arr {
		fmt.Printf("%d ", vl+absIs(mn))
	}
}

func absIs(x int64) int64 {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

func max(a, b int64) int64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int64) int64 {
	if a < b {
		return a
	} else {
		return b
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscan(reader, &n)

	arr := make([]int64, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscan(reader, &arr[i])
	}

	var mn, mx int64
	elem := make([]int64, n)

	used := make(map[int64]bool)
	mn, mx = 1, 1
	elem[0] = 1
	used[1] = true
	for i, vl := range arr {
		elem[i+1] = elem[i] + vl
		if elem[i+1] < mn {
			mn = elem[i+1]
		} else if elem[i+1] > mx {
			mx = elem[i+1]
		}
		if used[elem[i+1]] {
			fmt.Println(-1)
			return
		}

		used[elem[i+1]] = true
	}

	if mx+absIs(mn) > int64(n) {
		fmt.Println(-1)
		return
	}

	for _, vl := range elem {
		fmt.Print(vl+absIs(mn), " ")
	}
}

func absIs(x int64) int64 {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	mat[0] = 0
	var v int
	var min int = 0
	err := false
	for i:=0;i < n-1;i++{
		fmt.Fscanf(buf, "%d", &v)
		mat[i+1] = mat[i]+v
		if min > mat[i+1]{
			min = mat[i+1]
		}
		if mat[i+1] > n || mat[i] <= 0-n{
			err=true
		}
	}
	fmt.Fscanf(buf, "\n")
	if err{
		fmt.Printf("-1\n")
		return
	}
	if min <=0 {
		min = 0-min
		for i := 0; i < n; i++ {
			mat[i] += min+1
		}
	}
	flag := make([]bool,n+1)
	for i:=0;i < n;i++{
		if mat[i] < 0{
			fmt.Printf("hhhhhhhhhhh %d %d\n",min,mat[i])
			return
		}
		if mat[i] > n ||flag[mat[i]]{
			fmt.Printf("-1\n")
			return
		}
		flag[mat[i]] = true
	}
	for i:=0;i < n;i++{
		if i!=0{
			fmt.Printf(" ")
		}
		fmt.Printf("%d",mat[i])
	}
	fmt.Printf("\n")
}

/**
0 0
0 1
3
UDD
 */

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscanf(reader, "%d\n", &n)

	arr := make([]int64, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscanf(reader, "%d ", &arr[i])
	}

	var mn, mx int64 = 1, 1
	elem := make([]int64, n)
	used := make(map[int64]bool)

	elem[0], used[1] = 1, true

	for i, vl := range arr {
		elem[i+1] = elem[i] + vl

		mn = min(mn, elem[i+1])
		mx = max(mx, elem[i+1])

		if used[elem[i+1]] {
			fmt.Printf("-1\n")
			return
		}

		used[elem[i+1]] = true
	}

	if mx+absIs(mn) > int64(n) {
		fmt.Printf("-1\n")
		return
	}

	for _, vl := range elem {
		fmt.Printf("%d ", vl+absIs(mn))
	}
}

func absIs(x int64) int64 {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

func max(a, b int64) int64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int64) int64 {
	if a < b {
		return a
	} else {
		return b
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func toInt(buf []byte) int {
	n, mul := 0, 1
	for i, v := range buf {
		if i == 0 && v == '-' {
			mul = -1
			continue
		}
		n = n*10 + int(v-'0')
	}

	return mul * n
}

func solve(n int, q []int) ([]int, bool) {
	p := []int{n}

	p = append(p, q...)

	min := n
	for i := 1; i < n; i++ {
		p[i] += p[i-1]
		if p[i] < min {
			min = p[i]
		}
	}

	fix := 1 - min
	used := map[int]bool{}

	for i := range p {
		p[i] += fix
		used[p[i]] = true
	}

	isValid := true
	for i := 1; isValid && (i <= n); i++ {
		isValid = used[i]
	}

	return p, isValid
}

func main() {
	n := 0

	fmt.Scan(&n)
	q := make([]int, n-1)

	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for i := range q {
		scanner.Scan()
		q[i] = toInt(scanner.Bytes())
	}

	p, isValid := (solve(n, q))
	if !isValid {
		p = []int{-1}
	}

	output := make([]string, len(p))

	for i, n := range p {
		output[i] = strconv.Itoa(n)
	}

	fmt.Println(strings.Join(output, " "))
}

// Author: sighduck
// URL: https://codeforces.com/contest/1141/problem/C

package main

import (
	"bufio"
	"fmt"
	"os"
)

type Metadata struct {
	MaxIncrease int
	MaxDecrease int
}

type Answer struct {
	Exists bool
	Array  []int
}

func max(x int, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x int, y int) int {
	if x < y {
		return x
	}
	return y
}

func getMetadata(a []int, i int, n int, runningSum int, maxIncrease int, maxDecrease int) Metadata {
	if i == 0 {
		return getMetadata(a, i+1, n, a[0], a[0], a[0])
	}
	if i == n-1 {
		return Metadata{maxIncrease, maxDecrease}
	}
	newSum := runningSum + a[i]
	return getMetadata(a, i+1, n, newSum, max(newSum, maxIncrease), min(newSum, maxDecrease))
}

func createArray(a []int, n int, start int) []int {
	newArr := make([]int, n)
	newArr[0] = start
	for i := 1; i < n; i++ {
		newArr[i] = newArr[i-1] + a[i-1]
	}
	return newArr
}

func checkArray(array []int, minElem int, maxElem int) bool {
	arrayMap := make(map[int]bool)
	for _, elem := range array {
		if arrayMap[elem] == true || elem < minElem || elem > maxElem {
			return false
		}
		arrayMap[elem] = true
	}
	return true
}

func Solve(n int, a []int) Answer {
	m := getMetadata(a, 0, n, 0, 0, 0)
	start := -1*m.MaxDecrease + 1
	end := n - m.MaxIncrease
	if end < start {
		return Answer{Exists: false, Array: []int{}}
	}
	array := createArray(a, n, max(1, start))
	if !checkArray(array, 1, n) {
		return Answer{Exists: false, Array: []int{}}
	}
	return Answer{Exists: true, Array: array}
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	a := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	answer := Solve(n, a)
	if !answer.Exists {
		fmt.Fprintf(writer, "-1\n")
	} else {
		for _, elem := range answer.Array {
			fmt.Fprintf(writer, "%d ", elem)
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	mat[0] = 0
	var v int
	var min int = 0
	for i:=0;i < n-1;i++{
		fmt.Fscanf(buf, "%d ", &v)
		mat[i+1] = mat[i]+v
		if min > mat[i+1]{
			min = mat[i+1]
		}
	}
	if min <=0 {
		min = 0-min
		for i := 0; i < n; i++ {
			mat[i] += min+1
		}
	}
	flag := make([]bool,n+1)
	for i:=0;i < n;i++{
		if mat[i] > n ||flag[mat[i]]{
			fmt.Printf("-1\n")
			return
		}
	}
	for i:=0;i < n;i++{
		if i!=0{
			fmt.Printf(" ")
		}
		fmt.Printf("%d",mat[i])
	}
	fmt.Printf("\n")
}

/**
0 0
0 1
3
UDD
 */

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	mat[0] = 0
	var v int
	var min int = 0
	for i:=0;i < n-1;i++{
		fmt.Fscanf(buf, "%d", &v)
		mat[i+1] = mat[i]+v
		if min > mat[i+1]{
			min = mat[i+1]
		}
	}
	fmt.Fscanf(buf, "\n")
	if min <=0 {
		min = 0-min
		for i := 0; i < n; i++ {
			mat[i] += min+1
		}
	}
	flag := make([]bool,n+1)
	for i:=0;i < n;i++{
		if mat[i] < 0{
			fmt.Printf("hhhhhhhhhhh %d %d\n",min,mat[i])
			return
		}
		if mat[i] > n ||flag[mat[i]]{
			fmt.Printf("-1\n")
			return
		}
		flag[mat[i]] = true
	}
	for i:=0;i < n;i++{
		if i!=0{
			fmt.Printf(" ")
		}
		fmt.Printf("%d",mat[i])
	}
	fmt.Printf("\n")
}

/**
0 0
0 1
3
UDD
 */

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	mat[0] = 0
	var v int
	var min int = 0
	err := true
	for i:=0;i < n-1;i++{
		fmt.Fscanf(buf, "%d", &v)
		mat[i+1] = mat[i]+v
		if min > mat[i+1]{
			min = mat[i+1]
		}
		if mat[i+1] > n{
			err=false
		}
	}
	fmt.Fscanf(buf, "\n")
	if err{
		fmt.Printf("-1\n")
		return
	}
	if min <=0 {
		min = 0-min
		for i := 0; i < n; i++ {
			mat[i] += min+1
		}
	}
	flag := make([]bool,n+1)
	for i:=0;i < n;i++{
		if mat[i] < 0{
			fmt.Printf("hhhhhhhhhhh %d %d\n",min,mat[i])
			return
		}
		if mat[i] > n ||flag[mat[i]]{
			fmt.Printf("-1\n")
			return
		}
		flag[mat[i]] = true
	}
	for i:=0;i < n;i++{
		if i!=0{
			fmt.Printf(" ")
		}
		fmt.Printf("%d",mat[i])
	}
	fmt.Printf("\n")
}

/**
0 0
0 1
3
UDD
 */

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	mat[0] = 0
	var v int
	var min int = 0
	for i:=0;i < n-1;i++{
		fmt.Fscanf(buf, "%d", &v)
		mat[i+1] = mat[i]+v
		if min > mat[i+1]{
			min = mat[i+1]
		}
	}
	fmt.Fscanf(buf, "\n")
	if min <=0 {
		min = 0-min
		for i := 0; i < n; i++ {
			mat[i] += min+1
		}
	}
	flag := make([]bool,n+1)
	for i:=0;i < n;i++{
		if mat[i] < 0{
			fmt.Printf("hhhhhhhhhhh\n")
			return
		}
		if mat[i] > n ||flag[mat[i]]{
			fmt.Printf("-1\n")
			return
		}
		flag[mat[i]] = true
	}
	for i:=0;i < n;i++{
		if i!=0{
			fmt.Printf(" ")
		}
		fmt.Printf("%d",mat[i])
	}
	fmt.Printf("\n")
}

/**
0 0
0 1
3
UDD
 */

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	mat[0] = 0
	var v int
	var min int = 0
	err := false
	for i:=0;i < n-1;i++{
		fmt.Fscanf(buf, "%d", &v)
		mat[i+1] = mat[i]+v
		if min > mat[i+1]{
			min = mat[i+1]
		}
		if mat[i+1] > n{
			err=true
		}
	}
	fmt.Fscanf(buf, "\n")
	if err{
		fmt.Printf("-1\n")
		return
	}
	if min <=0 {
		min = 0-min
		for i := 0; i < n; i++ {
			mat[i] += min+1
		}
	}
	flag := make([]bool,n+1)
	for i:=0;i < n;i++{
		if mat[i] < 0{
			fmt.Printf("hhhhhhhhhhh %d %d\n",min,mat[i])
			return
		}
		if mat[i] > n ||flag[mat[i]]{
			fmt.Printf("-1\n")
			return
		}
		flag[mat[i]] = true
	}
	for i:=0;i < n;i++{
		if i!=0{
			fmt.Printf(" ")
		}
		fmt.Printf("%d",mat[i])
	}
	fmt.Printf("\n")
}

/**
0 0
0 1
3
UDD
 */

package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	_, _ = fmt.Scanf("%d", &n)
	a := make([]int, n - 1)
	for i := 0; i < n - 1; i++ {
		_, _ = fmt.Scanf("%d", &a[i])
	}
	ans := make([]int, n)
	mn := 0
	for i := 1; i < n; i++ {
		ans[i] = ans[i - 1] + a[i - 1]
		mn = min(mn, ans[i])
	}
	for i := 0; i < n; i++ {
		ans[i] -= mn
	}
	yes := true
	anss := make([]int, n)
	copy(anss, ans)
	sort.Ints(anss)
	for i := 0; i < n; i++ {
		yes = yes && (anss[i] == i)
	}
	if yes {
		for i := 0; i < n; i++ {
			fmt.Print(ans[i] + 1, " ")
		}
	} else {
		fmt.Println(-1)
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%v],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 2) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%v],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
	}
	// fmt.Printf("%+v\n", a[:5])
	s := a[0]
	for i := 1; i < n-1; i++ {
		s += a[i-1] + a[i]
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 <= 0 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] <= 0 || b[i] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
		if n == 200000 && a[i] != 1 {
			fmt.Printf("i=%d,a[i]=%d\n", i, a[i])
		}
	}
	// fmt.Printf("n=%d\n", n)
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 <= 0 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] <= 0 || b[i] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
		if n == 200000 && a[i] != i+1 {
			fmt.Printf("n=%d,i=%d,ai=%d\n", n, i, a[i])
		}
	}
	// fmt.Printf("n=%d\n", n)
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 < 1 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] < 1 || b[i+1] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
	}
	// fmt.Printf("n=%d\n", n)
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 <= 0 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] <= 0 || b[i] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
	}
	if n == 200000 {
		fmt.Printf("a_0=%d,a_200000=%d\n", a[0], a[n-1])
	}
	// fmt.Printf("n=%d\n", n)
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 < 1 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] < 1 || b[i+1] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%v],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 2) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%v],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
	}
	// fmt.Printf("%+v\n", a[:n-1])
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 <= 0 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] <= 0 || b[i] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
		if n == 200000 && a[i] != 1 {
			fmt.Printf("n=%d,i=%d,ai=%d\n", n, i, a[i])
		}
	}
	// fmt.Printf("n=%d\n", n)
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 < 1 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] < 1 || b[i+1] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
	}
	// fmt.Printf("n=%d\n", n)
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	if n == 200000 {
		fmt.Printf("sa=%d,s=%d\n", sa, s)
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 < 1 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] < 1 || b[i+1] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type scanner struct {
	f *bufio.Reader
}

func (s *scanner) ReadInt() (int, error) {
	var ch byte
	var err error
	for {
		ch, err = s.f.ReadByte()
		if err == io.EOF {
			return 0, err
		}
		if ch == '-' || (ch >= '0' && ch <= '9') {
			break
		}
	}
	neg, val := 1, 0
	if ch == '-' {
		neg = -1
	} else {
		val = int(ch - '0')
	}
	// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	for {
		ch, err = s.f.ReadByte()
		if err != nil || ch < '0' || ch > '9' {
			break
		}
		val = (val << 3) + (val << 1) + int(ch-'0')
		// fmt.Printf("ch=[%c],neg=[%v],val=[%v]\n", ch, neg, val)
	}
	return neg * val, err
}

func newStdScanner() *scanner {
	return &scanner{f: bufio.NewReader(os.Stdin)}
}

func main() {
	var (
		a = make([]int, 200002)
	)
	cin := newStdScanner()
	n, _ := cin.ReadInt()
	for i := 0; i < n-1; i++ {
		a[i], _ = cin.ReadInt()
	}
	fmt.Printf("n=%d\n", n)
	// fmt.Printf("%+v\n", a[:n-1])
	sa, s := 0, 0
	for i := 0; i < n-1; i++ {
		sa += a[i]
		s += sa
	}
	a1 := (n*(n+1)/2 - s) / n
	if a1 <= 0 || a1 > n {
		fmt.Println("-1")
		return
	}
	b := make([]int, 200002)
	vis := make([]bool, 200002)
	b[0] = a1
	vis[a1] = true
	for i := 0; i < n-1; i++ {
		b[i+1] = b[i] + a[i]
		if b[i+1] <= 0 || b[i] > n || vis[b[i+1]] {
			fmt.Println("-1")
			return
		}
		vis[b[i+1]] = true
	}
	fmt.Printf("%d", b[0])
	for i := 1; i < n; i++ {
		fmt.Printf(" %d", b[i])
	}
	fmt.Println("")
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscan(reader, &n)

	arr := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscan(reader, &arr[i])
	}

	var mn, mx int
	elem := make([]int, n)

	mn = 1
	elem[0] = 1
	for i, vl := range arr {
		elem[i+1] = elem[i] + vl
		if elem[i+1] < mn {
			mn = elem[i+1]
		} else if elem[i+1] > mx {
			mx = elem[i+1]
		}
	}

	if mx+absIs(mn) > n {
		fmt.Println(-1)
		return
	}
	for _, vl := range elem {
		fmt.Print(vl+absIs(mn), " ")
	}
}

func absIs(x int) int {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscan(reader, &n)

	arr := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscan(reader, &arr[i])
	}

	var mn, mx int
	elem := make([]int, n)

	mn = 1
	elem[0] = 1
	for i, vl := range arr {
		elem[i+1] = elem[i] + vl
		if elem[i+1] < mn {
			mn = elem[i+1]
			fmt.Println(elem[i+1])
		} else if elem[i+1] > mx {
			mx = elem[i+1]
		}
	}

	if mx+absIs(mn) > n {
		fmt.Println(-1)
		return
	}
	for _, vl := range elem {
		fmt.Print(vl+absIs(mn), " ")
	}
}

func absIs(x int) int {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscan(reader, &n)

	arr := make([]int64, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscan(reader, &arr[i])
	}

	var mn, mx int64
	elem := make([]int64, n)

	used := make(map[int64]bool)
	mn = 1
	elem[0] = 1
	used[1] = true
	for i, vl := range arr {
		elem[i+1] = elem[i] + vl
		if elem[i+1] < mn {
			mn = elem[i+1]
		} else if elem[i+1] > mx {
			mx = elem[i+1]
		}
		if used[elem[i+1]] {
			fmt.Println(-1)
			return
		}

		used[elem[i+1]] = true
	}

	if mx+absIs(mn) > int64(n) {
		fmt.Println(-1)
		return
	}

	for _, vl := range elem {
		fmt.Print(vl+absIs(mn), " ")
	}
}

func absIs(x int64) int64 {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscanf(reader, "%d\n", &n)

	var mn, mx int64 = 0, 0
	arr := make([]int64, n)
	for i := 1; i < n; i++ {
		fmt.Fscanf(reader, "%d ", &arr[i])
		arr[i] = arr[i] + arr[i-1]
		mn = min(mn, arr[i])
		mx = max(mx, arr[i])

		if mx+absIs(mn) > int64(n) {
			fmt.Println(-1)
			return
		}
	}

	for _, vl := range arr {
		fmt.Printf("%d ", vl+absIs(mn))
	}
}

func absIs(x int64) int64 {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

func max(a, b int64) int64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a, b int64) int64 {
	if a < b {
		return a
	} else {
		return b
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	var n int
	fmt.Fscan(reader, &n)

	arr := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscan(reader, &arr[i])
	}

	var mn, mx int
	elem := make([]int, n)

	used := make(map[int]bool)
	mn = 1
	elem[0] = 1
	used[1] = true
	for i, vl := range arr {
		elem[i+1] = elem[i] + vl
		if elem[i+1] < mn {
			mn = elem[i+1]
		} else if elem[i+1] > mx {
			mx = elem[i+1]
		}
		if used[i+1] {
			fmt.Println(-1)
			return
		}

		used[i+1] = true
	}

	fmt.Println(elem)
	if mx+absIs(mn) > n {
		fmt.Println(-1)
		return
	}

	for _, vl := range elem {
		fmt.Print(vl+absIs(mn), " ")
	}
}

func absIs(x int) int {
	if x <= 0 {
		return -x + 1
	} else {
		return 0
	}
}

// Author: sighduck
// URL: https://codeforces.com/contest/1141/problem/C

package main

import (
	"bufio"
	"fmt"
	"os"
)

type Metadata struct {
	MaxIncrease int
	MaxDecrease int
}

type Answer struct {
	Exists bool
	Array  []int
}

func max(x int, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x int, y int) int {
	if x < y {
		return x
	}
	return y
}

func getMetadata(a []int, i int, n int, runningSum int, maxIncrease int, maxDecrease int) Metadata {
	if i == 0 {
		return getMetadata(a, i+1, n, a[0], a[0], a[0])
	}
	if i == n-1 {
		return Metadata{maxIncrease, maxDecrease}
	}
	newSum := runningSum + a[i]
	return getMetadata(a, i+1, n, newSum, max(newSum, maxIncrease), min(newSum, maxDecrease))
}

func createArray(a []int, n int, start int) []int {
	newArr := make([]int, n)
	newArr[0] = start
	for i := 1; i < n; i++ {
		newArr[i] = newArr[i-1] + a[i-1]
	}
	return newArr
}

func Solve(n int, a []int) Answer {
	m := getMetadata(a, 0, n, 0, 0, 0)
	start := -1*m.MaxDecrease + 1
	end := n - m.MaxIncrease
	if end < start {
		return Answer{Exists: false, Array: []int{}}
	}
	array := createArray(a, n, max(1, start))
	arrayMap := make(map[int]bool)
	for _, elem := range array {
		if arrayMap[elem] == true {
			return Answer{Exists: false, Array: []int{}}
		}
		arrayMap[elem] = true
	}
	return Answer{Exists: true, Array: array}
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	a := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	answer := Solve(n, a)
	if !answer.Exists {
		fmt.Fprintf(writer, "-1\n")
	} else {
		for _, elem := range answer.Array {
			fmt.Fprintf(writer, "%d ", elem)
		}
	}
}

// Author: sighduck
// URL: https://codeforces.com/contest/1141/problem/C

package main

import (
	"bufio"
	"fmt"
	"os"
)

type Metadata struct {
	MaxIncrease int
	MaxDecrease int
}

type Answer struct {
	Exists bool
	Array  []int
}

func max(x int, y int) int {
	if x > y {
		return x
	}
	return y
}

func min(x int, y int) int {
	if x < y {
		return x
	}
	return y
}

func getMetadata(a []int, i int, n int, runningSum int, maxIncrease int, maxDecrease int) Metadata {
	if i == 0 {
		return getMetadata(a, i+1, n, a[0], a[0], a[0])
	}
	if i == n-1 {
		return Metadata{maxIncrease, maxDecrease}
	}
	newSum := runningSum + a[i]
	return getMetadata(a, i+1, n, newSum, max(newSum, maxIncrease), min(newSum, maxDecrease))
}

func createArray(a []int, n int, start int) []int {
	newArr := make([]int, n)
	newArr[0] = start
	for i := 1; i < n; i++ {
		newArr[i] = newArr[i-1] + a[i-1]
	}
	return newArr
}

func Solve(n int, a []int) Answer {
	m := getMetadata(a, 0, n, 0, 0, 0)
	start := -1*m.MaxDecrease + 1
	end := n - m.MaxIncrease
	if end < start {
		return Answer{Exists: false, Array: []int{}}
	}
	return Answer{Exists: true, Array: createArray(a, n, max(1, start))}
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var n int
	fmt.Fscanf(reader, "%d\n", &n)
	a := make([]int, n-1)
	for i := 0; i < n-1; i++ {
		fmt.Fscanf(reader, "%d", &a[i])
	}

	answer := Solve(n, a)
	if !answer.Exists {
		fmt.Fprintf(writer, "-1\n")
	} else {
		for _, elem := range answer.Array {
			fmt.Fprintf(writer, "%d ", elem)
		}
	}
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

const N = 100005
const mod = int(1e9) + 7

var n int
var a[][] int
var sum [] int

func main() {
	var reader = bufio.NewReader(os.Stdin)
	var writer = bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	fmt.Fscanf(reader, "%d\n", &n)

	a = make([][]int, 1000001)
	for i := 1; i <= n; i++ {
		var val int
		fmt.Fscanf(reader, "%d", &val)
		if a[val] == nil {
			a[val] = make([]int, 0)
		}
		a[val] = append(a[val], i)
	}

	sum = make([]int, 0)
	var layer = make([]int, 0)

	var ret = 0
	for i := 1; i <= n; i++ {
		var newLayer = make([]int, 0)
		for j := i; j <= 1000000; j += i {
			if a[j] != nil {
				for _, z := range a[j] {
					newLayer = append(newLayer, z)
				}
			}
		}
		sort.Ints(newLayer)

		var newSum = make([]int, 0)

		for _, z := range newLayer {
			var way = 1
			var sz = len(newSum)

			if i > 1 {
				way = 0
				var l = 0
				var r = len(layer) - 1
				var pos = -1

				for l <= r {
					var mid = (l + r) >> 1
					if layer[mid] < z {
						pos = mid
						l = mid + 1
					} else {
						r = mid - 1
					}
				}

				if pos != -1 {
					way = sum[pos]
				}
			}

			ret = (ret + way) % mod

			if sz > 0 {
				way += newSum[sz-1]
				way %= mod
			}

			newSum = append(newSum, way)
		}
		sum, newSum = newSum, sum
		layer, newLayer = newLayer, layer
	}

	fmt.Fprintf(writer, "%d\n", ret)
}

/*
URL:
https://codeforces.com/problemset/problem/1061/C
*/

package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

/********** FAU standard libraries **********/

//fmt.Sprintf("%b\n", 255) 	// binary expression

/********** I/O usage **********/

//str := ReadString()
//i := ReadInt()
//X := ReadIntSlice(n)
//S := ReadRuneSlice()
//a := ReadFloat64()
//A := ReadFloat64Slice(n)

//str := ZeroPaddingRuneSlice(num, 32)
//str := PrintIntsLine(X...)

/*******************************************************************/

const (
	// General purpose
	MOD          = 1000000000 + 7
	ALPHABET_NUM = 26
	INF_INT64    = math.MaxInt64
	INF_BIT60    = 1 << 60
	INF_INT32    = math.MaxInt32
	INF_BIT30    = 1 << 30
	NIL          = -1

	// for dijkstra, prim, and so on
	WHITE = 0
	GRAY  = 1
	BLACK = 2
)

func init() {
	// bufio.ScanWords <---> bufio.ScanLines
	ReadString = newReadString(os.Stdin, bufio.ScanWords)
	stdout = bufio.NewWriter(os.Stdout)
}

var (
	n int
	A []int

	dp [100000 + 50]int64
)

func main() {
	n = ReadInt()
	A = ReadIntSlice(n)

	dp[0] = 1
	for i := 0; i < n; i++ {
		D := divisor(A[i])
		sort.Sort(sort.Reverse(sort.IntSlice(D)))

		for _, d := range D {
			if d <= i+1 {
				dp[d] += dp[d-1]
				dp[d] %= MOD
			} else {
			}
		}
	}

	ans := int64(0)
	for j := 1; j <= n; j++ {
		ans += dp[j]
		ans %= MOD
	}
	fmt.Println(ans)
}

// 約数の列挙: O(sqrt(n))
func divisor(n int) []int {
	res := []int{}

	for i := 1; i*i <= n; i++ {
		if n%i == 0 {
			res = append(res, i)
			if i != (n / i) {
				res = append(res, (n / i))
			}
		}
	}

	return res
}

/*******************************************************************/

/*********** I/O ***********/

var (
	// ReadString returns a WORD string.
	ReadString func() string
	stdout     *bufio.Writer
)

func newReadString(ior io.Reader, sf bufio.SplitFunc) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+9)) // for Codeforces
	r.Split(sf)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

// ReadInt returns an integer.
func ReadInt() int {
	return int(readInt64())
}
func ReadInt2() (int, int) {
	return int(readInt64()), int(readInt64())
}
func ReadInt3() (int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64())
}
func ReadInt4() (int, int, int, int) {
	return int(readInt64()), int(readInt64()), int(readInt64()), int(readInt64())
}

// ReadInt64 returns as integer as int64.
func ReadInt64() int64 {
	return readInt64()
}
func ReadInt64_2() (int64, int64) {
	return readInt64(), readInt64()
}
func ReadInt64_3() (int64, int64, int64) {
	return readInt64(), readInt64(), readInt64()
}
func ReadInt64_4() (int64, int64, int64, int64) {
	return readInt64(), readInt64(), readInt64(), readInt64()
}

func readInt64() int64 {
	i, err := strconv.ParseInt(ReadString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// ReadIntSlice returns an integer slice that has n integers.
func ReadIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt()
	}
	return b
}

// ReadInt64Slice returns as int64 slice that has n integers.
func ReadInt64Slice(n int) []int64 {
	b := make([]int64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadInt64()
	}
	return b
}

// ReadFloat64 returns an float64.
func ReadFloat64() float64 {
	return float64(readFloat64())
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(ReadString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// ReadFloatSlice returns an float64 slice that has n float64.
func ReadFloat64Slice(n int) []float64 {
	b := make([]float64, n)
	for i := 0; i < n; i++ {
		b[i] = ReadFloat64()
	}
	return b
}

// ReadRuneSlice returns a rune slice.
func ReadRuneSlice() []rune {
	return []rune(ReadString())
}

/*********** Debugging ***********/

// ZeroPaddingRuneSlice returns binary expressions of integer n with zero padding.
// For debugging use.
func ZeroPaddingRuneSlice(n, digitsNum int) []rune {
	sn := fmt.Sprintf("%b", n)

	residualLength := digitsNum - len(sn)
	if residualLength <= 0 {
		return []rune(sn)
	}

	zeros := make([]rune, residualLength)
	for i := 0; i < len(zeros); i++ {
		zeros[i] = '0'
	}

	res := []rune{}
	res = append(res, zeros...)
	res = append(res, []rune(sn)...)

	return res
}

// Strtoi is a wrapper of strconv.Atoi().
// If strconv.Atoi() returns an error, Strtoi calls panic.
func Strtoi(s string) int {
	if i, err := strconv.Atoi(s); err != nil {
		panic(errors.New("[argument error]: Strtoi only accepts integer string"))
	} else {
		return i
	}
}

// PrintIntsLine returns integers string delimited by a space.
func PrintIntsLine(A ...int) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.Itoa(A[i])
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintIntsLine returns integers string delimited by a space.
func PrintInts64Line(A ...int64) string {
	res := []rune{}

	for i := 0; i < len(A); i++ {
		str := strconv.FormatInt(A[i], 10) // 64bit int version
		res = append(res, []rune(str)...)

		if i != len(A)-1 {
			res = append(res, ' ')
		}
	}

	return string(res)
}

// PrintfDebug is wrapper of fmt.Fprintf(os.Stderr, format, a...)
func PrintfDebug(format string, a ...interface{}) {
	fmt.Fprintf(os.Stderr, format, a...)
}

// PrintfBufStdout is function for output strings to buffered os.Stdout.
// You may have to call stdout.Flush() finally.
func PrintfBufStdout(format string, a ...interface{}) {
	fmt.Fprintf(stdout, format, a...)
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

var (
	MOD = int64(1000000007)
	DIV = make([]int, 1000001)
)

func Init() {
	for i := 2; i < len(DIV); i++ {
		if DIV[i] != 0 {
			continue
		}
		DIV[i] = i
		if i > len(DIV)/i {
			continue
		}
		for j := i * i; j < len(DIV); j += i {
			DIV[j] = i
		}
	}
}

func factorsHelp(p, f []int, idx, s int, lst *[]int) {
	if idx >= len(p) {
		*lst = append(*lst, s)
		return
	}
	m := 1
	for i := 0; i <= f[idx]; i++ {
		factorsHelp(p, f, idx+1, s*m, lst)
		m *= p[idx]
	}
}

func factors(x int) []int {
	divs := make(map[int]int)
	r := x
	for r > 1 {
		divs[DIV[r]]++
		r = r / DIV[r]
	}

	var p, f []int
	for k, v := range divs {
		p = append(p, k)
		f = append(f, v)
	}

	var lst []int
	factorsHelp(p, f, 0, 1, &lst)
	return lst

	// pLen := len(p)
	// set := make(map[int]bool)
	// for i := 0; i < (1 << uint(pLen)); i++ {
	// 	f := 1
	// 	for b := 0; b < pLen; b++ {
	// 		if ((i >> uint(b)) & 1) == 1 {
	// 			f *= p[b]
	// 		}
	// 	}
	// 	set[f] = true
	// }

	// var lst []int
	// for k := range set {
	// 	lst = append(lst, k)
	// }
	// return lst
}

func Solve(io *FastIO) {
	N := io.NextInt()
	A := io.NextIntArray(N)

	dp := make([]int64, 1000001)
	next := make([]int64, 1000001)
	for _, a := range A {
		facs := factors(a)
		for _, f := range facs {
			next[f] += dp[f-1]
			next[f] %= MOD
		}
		next[1] = 1

		for _, f := range facs {
			dp[f] += next[f]
			dp[f] %= MOD

			next[f] = 0
		}
	}

	var ans int64
	for _, f := range dp {
		ans += f
		ans %= MOD
	}
	io.Println(ans)
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
	case 0, '\n', '\r':
		return true
	default:
		return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

var (
	MOD      = int64(1000000007)
	DIVISORS = make([][]int, 1000001)
)

func Init() {
	for i := 1; i <= 1000000; i++ {
		for j := i; j <= 1000000; j += i {
			DIVISORS[j] = append(DIVISORS[j], i)
		}
	}
}

func Solve(io *FastIO) {
	N := io.NextInt()
	A := io.NextIntArray(N)

	dp := make([]int64, 1000001)
	next := make([]int64, 1000001)
	for _, a := range A {
		for _, f := range DIVISORS[a] {
			next[f] += dp[f-1]
			next[f] %= MOD
		}
		next[1] = 1

		for _, f := range DIVISORS[a] {
			dp[f] += next[f]
			dp[f] %= MOD

			next[f] = 0
		}
	}

	var ans int64
	for _, f := range dp {
		ans += f
		ans %= MOD
	}
	io.Println(ans)
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
	case 0, '\n', '\r':
		return true
	default:
		return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

const (
	mod  = 1e9 + 7
	maxA = 1e6
)

var divs = make([]int, 100)

var primes = []int{2}

func init() {
	for i := 3; i*i <= maxA; i += 2 {
		found := false
		for _, p := range primes {
			if i%p == 0 {
				found = true
				break
			}
		}
		if !found {
			primes = append(primes, i)
		}
	}
}

func divisors(x int) []int {
	divs = divs[:1]
	divs[0] = x
	for _, p := range primes {
		if x < p {
			break
		}
		num := 0
		for x%p == 0 {
			num++
			x /= p
		}
		if num > 0 {
			for _, d := range divs {
				pp := p
				for i := 0; i < num; i++ {
					divs = append(divs, d/pp)
					pp *= p
				}
			}
		}
	}
	if x != 1 {
		for _, d := range divs {
			divs = append(divs, d/x)
		}
	}
	sort.Ints(divs)
	return divs
}

func main() {
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		fmt.Fscan(in, &a[i])
	}
	num := make([]int, n+1)
	num[0] = 1
	for _, a := range a {
		divs := divisors(a)
		for i := len(divs) - 1; i >= 0; i-- {
			div := divs[i]
			if div <= n {
				num[div] = (num[div] + num[div-1]) % mod
			}
		}
	}

	ans := 0
	for _, num := range num[1:] {
		ans = (ans + num) % mod
	}
	fmt.Println(ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var cache map[int64][]int = make(map[int64][]int)
func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int  ,max int64,p []int)[]int{

	var nn int64= int64(n)
	c,ok := cache[nn]
	if ok{
		return c
	}
	if max > int64(n){
		max =int64( n)
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && int64(n) <= max{
		res = append(res,n)
	}
	var lent = len(p)

//	fmt.Printf("n=%d lent=%d\n",n,lent)
	for i:= 0;i < lent&&p[i] <= n;i++{
		if n%p[i] != 0{
			continue
		}
//		fmt.Printf("===get div %d\n",p[i])
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i];n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				var tmpd int64 = int64(m)
				tmpd *= int64(res[j])
				if tmpd <=max &&tmpd < nn {
					if tmpd<= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=p[i]
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	cache[nn]=res
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],int64(max),p)
	//		fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 72
	var mat []int = []int{383353,171666,386523,224379,150402,72524,81041,782234,486385,797836,794110,339698,774209,495068,912228,964393,944290,204638,73597,629048,113397,889283,312566,901932,599889,926485,583023,6632,766273,314862,166844,938593,689924,614015,818471,118112,51020,638346,801899,719300,916735,561257,173626,954749,626873,368197,965305,345106,803464,669983,863487,949532,572463,733386,375129,792457,67427,747310,5449,440026,974097,691335,254210,71525,654102,737445,791470,559123,649285,504554,115752,644067,101349}
	//var n int = 1
	//var mat []int = []int{964393}

	//	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],int64(max),p)
		oksp := okdiv(mat[i],max)

		if !compareIntSlice(sp,oksp){
			fmt.Printf("->%d sp!=oksp %v != %v p=%v\n",mat[i],sp,oksp,p)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int  ,max int64,p []int)[]int{
	if max > int64(n){
		max =int64( n)
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && int64(n) <= max{
		res = append(res,n)
	}
	var lent = len(p)
	var nn int64= int64(n)
//	fmt.Printf("n=%d lent=%d\n",n,lent)
	for i:= 0;i < lent&&p[i] <= n;i++{
		if n%p[i] != 0{
			continue
		}
//		fmt.Printf("===get div %d\n",p[i])
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i];n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				var tmpd int64 = int64(m)
				tmpd *= int64(res[j])
				if tmpd <=max &&tmpd < nn {
					if tmpd<= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=p[i]
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],int64(max),p)
	//		fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 72
	var mat []int = []int{383353,171666,386523,224379,150402,72524,81041,782234,486385,797836,794110,339698,774209,495068,912228,964393,944290,204638,73597,629048,113397,889283,312566,901932,599889,926485,583023,6632,766273,314862,166844,938593,689924,614015,818471,118112,51020,638346,801899,719300,916735,561257,173626,954749,626873,368197,965305,345106,803464,669983,863487,949532,572463,733386,375129,792457,67427,747310,5449,440026,974097,691335,254210,71525,654102,737445,791470,559123,649285,504554,115752,644067,101349}
	//var n int = 1
	//var mat []int = []int{964393}

	//	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],int64(max),p)
		oksp := okdiv(mat[i],max)

		if !compareIntSlice(sp,oksp){
			fmt.Printf("->%d sp!=oksp %v != %v p=%v\n",mat[i],sp,oksp,p)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

const (
	mod  = 1e9 + 7
	maxA = 1e6
)

var divs = make([]int, 100)

var primes = []int{2}

func init() {
	for i := 3; i*i <= maxA; i += 2 {
		found := false
		for _, p := range primes {
			if i%p == 0 {
				found = true
				break
			}
		}
		if !found {
			primes = append(primes, i)
		}
	}
}

func divisors(x int) []int {
	divs = divs[:1]
	divs[0] = x
	for _, p := range primes {
		if x < p {
			break
		}
		num := 0
		for x%p == 0 {
			num++
			x /= p
		}
		if num > 0 {
			for _, d := range divs {
				pp := p
				for i := 0; i < num; i++ {
					divs = append(divs, d/pp)
					pp *= p
				}
			}
		}
	}
	if x != 1 {
		for _, d := range divs {
			divs = append(divs, d/x)
		}
	}
	return divs
}

func main() {
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		fmt.Fscan(in, &a[i])
	}
	num := make([]int, n+1)
	num[0] = 1
	for _, a := range a {
		for _, div := range divisors(a) {
			if div <= n {
				num[div] = (num[div] + num[div-1]) % mod
			}
		}
	}

	ans := 0
	for _, num := range num[1:] {
		ans = (ans + num) % mod
	}
	fmt.Println(ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var in = bufio.NewReaderSize(os.Stdin, 2<<16)

const (
	mod  = 1e9 + 7
	maxA = 1e6
)

var divs = make([]int, 100)

var primes = []int{2}

func init() {
	for i := 3; i*i <= maxA; i += 2 {
		found := false
		for _, p := range primes {
			if i%p == 0 {
				found = true
				break
			}
		}
		if !found {
			primes = append(primes, i)
		}
	}
}

func divisors(x int) []int {
	divs = divs[:1]
	divs[0] = x
	for _, p := range primes {
		if x < p {
			break
		}
		num := 0
		for x%p == 0 {
			num++
			x /= p
		}
		if num > 0 {
			for _, d := range divs {
				pp := p
				for i := 0; i < num; i++ {
					divs = append(divs, d/pp)
					pp *= p
				}
			}
		}
	}
	if x != 1 {
		for _, d := range divs {
			divs = append(divs, d/x)
		}
	}
	return divs
}

func main() {
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	for i := range a {
		fmt.Fscan(in, &a[i])
	}
	num := make([]int, n+1)
	num[0] = 1
	for _, a := range a {
		for _, div := range divisors(a) {
			if div <= n {
				num[div] += num[div-1]
			}
		}
	}

	ans := 0
	for _, num := range num[1:] {
		ans = (ans + num) % mod
	}
	fmt.Println(ans)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	var nn int= n
//	fmt.Printf("n=%d lent=%d\n",n,lent)
	for i:= 0;i < lent&&p[i] <= n;i++{
		if n%p[i] != 0{
			continue
		}
//		fmt.Printf("===get div %d\n",p[i])
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i];n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < nn {
					if res[j]*m <= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=p[i]
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
	//		fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 72
	var mat []int = []int{383353,171666,386523,224379,150402,72524,81041,782234,486385,797836,794110,339698,774209,495068,912228,964393,944290,204638,73597,629048,113397,889283,312566,901932,599889,926485,583023,6632,766273,314862,166844,938593,689924,614015,818471,118112,51020,638346,801899,719300,916735,561257,173626,954749,626873,368197,965305,345106,803464,669983,863487,949532,572463,733386,375129,792457,67427,747310,5449,440026,974097,691335,254210,71525,654102,737445,791470,559123,649285,504554,115752,644067,101349}
	//var n int = 1
	//var mat []int = []int{964393}

	//	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)

		if !compareIntSlice(sp,oksp){
			fmt.Printf("->%d sp!=oksp %v != %v p=%v\n",mat[i],sp,oksp,p)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	for i:= 0;i < lent&&p[i] <= n/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i];n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					if res[j]*m <= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=p[i]
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 50
	var mat []int = []int{170081,797965,40736,224325,102476,20832,954026,923972,391400,247099,95141,927386,79799,749285,104039,200818,623552,872203,355273,838168,352783,850365,389351,930945,847154,608047,727586,549184,520573,608953,338849,536466,345479,589848,882827,771475,874283,787115,992590,128903,97800,74550,674140,282514,510849,106786,267881,163456,753022,925051}
	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("sp!=oksp %v != %v",sp,oksp)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	var nn int = n
	for i:= 0;i < lent&&p[i] <= nn/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i]; n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					if res[j]*m <= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=m
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 50
	var mat []int = []int{170081,797965,40736,224325,102476,20832,954026,923972,391400,247099,95141,927386,79799,749285,104039,200818,623552,872203,355273,838168,352783,850365,389351,930945,847154,608047,727586,549184,520573,608953,338849,536466,345479,589848,882827,771475,874283,787115,992590,128903,97800,74550,674140,282514,510849,106786,267881,163456,753022,925051}
	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("sp!=oksp %v != %v",sp,oksp)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	var nn int = n
	for i:= 0;i < lent&&p[i] <= nn/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i]; n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					if res[j]*m < 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=m
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 50
	var mat []int = []int{170081,797965,40736,224325,102476,20832,954026,923972,391400,247099,95141,927386,79799,749285,104039,200818,623552,872203,355273,838168,352783,850365,389351,930945,847154,608047,727586,549184,520573,608953,338849,536466,345479,589848,882827,771475,874283,787115,992590,128903,97800,74550,674140,282514,510849,106786,267881,163456,753022,925051}
	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("sp!=oksp %v != %v",sp,oksp)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	var nn int = n
	for i:= 0;i < lent&&p[i] <= nn/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i];n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					if res[j]*m <= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=p[i]
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 50
	var mat []int = []int{170081,797965,40736,224325,102476,20832,954026,923972,391400,247099,95141,927386,79799,749285,104039,200818,623552,872203,355273,838168,352783,850365,389351,930945,847154,608047,727586,549184,520573,608953,338849,536466,345479,589848,882827,771475,874283,787115,992590,128903,97800,74550,674140,282514,510849,106786,267881,163456,753022,925051}
	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("sp!=oksp %v != %v",sp,oksp)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)

//	fmt.Printf("n=%d lent=%d\n",n,lent)
	for i:= 0;i < lent&&p[i] <= n;i++{
		if n%p[i] != 0{
			continue
		}
//		fmt.Printf("===get div %d\n",p[i])
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i];n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max{
					if res[j]*m <= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=p[i]
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 72
	var mat []int = []int{383353,171666,386523,224379,150402,72524,81041,782234,486385,797836,794110,339698,774209,495068,912228,964393,944290,204638,73597,629048,113397,889283,312566,901932,599889,926485,583023,6632,766273,314862,166844,938593,689924,614015,818471,118112,51020,638346,801899,719300,916735,561257,173626,954749,626873,368197,965305,345106,803464,669983,863487,949532,572463,733386,375129,792457,67427,747310,5449,440026,974097,691335,254210,71525,654102,737445,791470,559123,649285,504554,115752,644067,101349}
	//var n int = 1
	//var mat []int = []int{964393}

	//	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
	//	fmt.Printf("->%d sp!=oksp %v != %v p=%v\n",mat[i],sp,oksp,p)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("->%d sp!=oksp %v != %v p=%v\n",mat[i],sp,oksp,p)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"fmt"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)

//	fmt.Printf("n=%d lent=%d\n",n,lent)
	for i:= 0;i < lent&&p[i] <= n;i++{
		if n%p[i] != 0{
			continue
		}
//		fmt.Printf("===get div %d\n",p[i])
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i];n%p[i] == 0; n/=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max{
					if res[j]*m <= 0{
						fmt.Print("res=",res[j]," m=",m,"\n")
					}
					newres = append(newres, res[j]*m)
				}
			}
			m *=p[i]
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	//buf := bufio.NewReader(os.Stdin)
	//var n int
	//fmt.Fscanf(buf, "%d\n", &n)
	//mat := make([]int,n)
	//for i := 0;i < n;i++{
	//	fmt.Fscanf(buf,"%d",&mat[i])
	//}
	//Solve(n,mat)
	HackC()
}

func HackC()  {
	var n int = 72
	var mat []int = []int{383353,171666,386523,224379,150402,72524,81041,782234,486385,797836,794110,339698,774209,495068,912228,964393,944290,204638,73597,629048,113397,889283,312566,901932,599889,926485,583023,6632,766273,314862,166844,938593,689924,614015,818471,118112,51020,638346,801899,719300,916735,561257,173626,954749,626873,368197,965305,345106,803464,669983,863487,949532,572463,733386,375129,792457,67427,747310,5449,440026,974097,691335,254210,71525,654102,737445,791470,559123,649285,504554,115752,644067,101349}
	//var n int = 1
	//var mat []int = []int{964393}

	//	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
	//	fmt.Printf("->%d sp!=oksp %v != %v p=%v\n",mat[i],sp,oksp,p)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("->%d sp!=oksp %v != %v p=%v\n",mat[i],sp,oksp,p)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	for i:= 0;i < lent&&p[i] <= n/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i]; n%m == 0; n/=m{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					newres = append(newres, res[j]*m)
				}
			}
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 50
	var mat []int = []int{170081,797965,40736,224325,102476,20832,954026,923972,391400,247099,95141,927386,79799,749285,104039,200818,623552,872203,355273,838168,352783,850365,389351,930945,847154,608047,727586,549184,520573,608953,338849,536466,345479,589848,882827,771475,874283,787115,992590,128903,97800,74550,674140,282514,510849,106786,267881,163456,753022,925051}
	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("sp!=oksp %v != %v",sp,oksp)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	for i:= 0;i < lent&&p[i] <= n/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i]; n%m == 0; m*=p[i]{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					newres = append(newres, res[j]*m)
				}
			}
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 50
	var mat []int = []int{170081,797965,40736,224325,102476,20832,954026,923972,391400,247099,95141,927386,79799,749285,104039,200818,623552,872203,355273,838168,352783,850365,389351,930945,847154,608047,727586,549184,520573,608953,338849,536466,345479,589848,882827,771475,874283,787115,992590,128903,97800,74550,674140,282514,510849,106786,267881,163456,753022,925051}
	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("sp!=oksp %v != %v",sp,oksp)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	for i:= 0;i < lent&&p[i] <= n/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i]; n%m == 0; m*=m{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					newres = append(newres, res[j]*m)
				}
			}
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var mod int64=1000000007
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	var max int = 0
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := prim(max)
//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := div(mat[i],max,p)
	//	fmt.Print(d)
	//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
	//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func Prim(n int)[]int{
	p := make([]int,0)
	flag := make([]bool,n+1)
	for i:=2;i*i <= n;i++{
		if flag[i] == false{
			for j:= 2 ;i*j <= n ;j++{
				flag[i*j] = true
			}
		}
	}
	for i := 2;i <= n;i++{
		if flag[i] == false{
			p = append(p,i)
		}
	}
	return p
}
func Div(n int,max int,p []int)[]int{
	if max > n{
		max = n
	}
	res := make([]int,0)
	res = append(res,1)
	if n>1 && n <= max{
		res = append(res,n)
	}
	var lent = len(p)
	var nn int = n
	for i:= 0;i < lent&&p[i] <= nn/2;i++{
		if n%p[i] != 0{
			continue
		}
		var tl int = len(res)
		newres := make([]int,0)
		for m :=p[i]; n%m == 0; n/=m{
			for j := 0;j < tl;j++{
				if res[j]*m <=max &&res[j]*m < n{
					newres = append(newres, res[j]*m)
				}
			}
		}
		res = append(res,newres...)
		//fmt.Printf("res=%v",res)
	}
	sort.Ints(res)
	return res
}
func Solve(n int,mat []int)  {
	var mod int64=1000000007
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	//	fmt.Print("p=",p,"\n")
	var sum int64=0
	dp := make([]int64,max+1)
	dp[0] = int64(1)
	for i := 0;i < n;i++{
		d := Div(mat[i],max,p)
		//	fmt.Print(d)
		//	fmt.Printf("\n")
		for j:= len(d)-1;j >= 0;j--{
			if d[j] <= 0||d[j] > max{
				fmt.Print("ERROR, unexpect d!!!! mat=",mat[i]," ,d=",d)
				return
			}
			dp[d[j]] =(dp[d[j]]+ dp[d[j]-1])%mod
			sum  = (sum+dp[d[j]-1])%mod
			//		fmt.Print("dp=",dp[d[j]-1],",sum=",sum,"\n")
		}
	}
	fmt.Print(sum)
}
func main(){

	buf := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscanf(buf, "%d\n", &n)
	mat := make([]int,n)
	for i := 0;i < n;i++{
		fmt.Fscanf(buf,"%d",&mat[i])
	}
	Solve(n,mat)
	//HackC()
}

func HackC()  {
	var n int = 50
	var mat []int = []int{170081,797965,40736,224325,102476,20832,954026,923972,391400,247099,95141,927386,79799,749285,104039,200818,623552,872203,355273,838168,352783,850365,389351,930945,847154,608047,727586,549184,520573,608953,338849,536466,345479,589848,882827,771475,874283,787115,992590,128903,97800,74550,674140,282514,510849,106786,267881,163456,753022,925051}
	Solve(n,mat)
	var max int = 0
	for i := 0;i < n;i++{
		if mat[i] > max{
			max = mat[i]
		}
	}
	if max > n{
		max = n
	}
	p := Prim(max)
	for i := len(mat)-1;i >= 0;i--{
		sp := Div(mat[i],max,p)
		oksp := okdiv(mat[i],max)
		if !compareIntSlice(sp,oksp){
			fmt.Printf("sp!=oksp %v != %v",sp,oksp)
		}
	}
}
func okdiv(n,max int)[]int  {
	res := make([]int,0)
	for i := 1;i <= n&&i <= max;i++{
		if n%i == 0{
			res = append(res,i)
		}
	}
	return res
}
func compareIntSlice(a,b []int)bool{
	lena := len(a)
	lenb := len(b)
	if lena != lenb {
		return false
	}
	for i:= 0 ;i < lena;i++{
		if a[i] != b[i]{
			return false
		}
	}
	return  true
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
)

var (
	MOD = int64(1000000007)
	DIV = make([]int, 1000001)
)

func Init() {
	for i := 2; i < len(DIV); i++ {
		if DIV[i] != 0 {
			continue
		}
		DIV[i] = i
		if i > len(DIV)/i {
			continue
		}
		for j := i * i; j < len(DIV); j += i {
			DIV[j] = i
		}
	}
}

func factors(x int) []int {
	var p []int
	r := x
	for r > 1 {
		p = append(p, DIV[r])
		r = r / DIV[r]
	}

	pLen := len(p)
	set := make(map[int]bool)
	for i := 0; i < (1 << uint(pLen)); i++ {
		f := 1
		for b := 0; b < pLen; b++ {
			if ((i >> uint(b)) & 1) == 1 {
				f *= p[b]
			}
		}
		set[f] = true
	}

	var lst []int
	for k := range set {
		lst = append(lst, k)
	}
	return lst
}

func Solve(io *FastIO) {
	N := io.NextInt()
	A := io.NextIntArray(N)

	dp := make([]int64, 1000001)
	next := make([]int64, 1000001)
	dp[0] = 1
	for _, a := range A {
		facs := factors(a)
		for _, f := range facs {
			next[f] += dp[f-1]
			next[f] %= MOD
		}

		for f := range facs {
			dp[f] += next[f]
			dp[f] %= MOD

			next[f] = 0
		}
	}

	var ans int64
	for _, f := range dp {
		ans += f
		ans %= MOD
	}
	io.Println(ans)
}

type FastIO struct {
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}

func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = (res * 10) + int(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = (res * 10) + int64(c-'0')
		c = io.NextChar()
	}
	return sgn * res
}

func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}

func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextInt()
	}
	return arr
}

func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}

func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextLong()
	}
	return arr
}

func (io *FastIO) NextString() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}

func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}

func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}

func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}

func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}

func IsLineBreakChar(c byte) bool {
	switch c {
	case 0, '\n', '\r':
		return true
	default:
		return false
	}
}

func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}


package main

import "fmt"

func main() {

	var n int

	fmt.Scan(&n)

	var v []int

	for i := 0; i < n; i++ {
		var val int
		fmt.Scan(&val)
		v = append(v, val)
	}

	resp := 0

	for i := 1; i < len(v)-1; i++ {
		if v[i] == 0 && v[i-1] == 1 && v[i+1] == 1 {
			v[i+1] = 0
			resp++
		}
	}

	fmt.Println(resp)
}

package main

import (
    "fmt"
)

func main() {
    var n int
    fmt.Scan(&n)
    arr := make([]int, n)
    res := 0
    for i := 0; i < n; i++ {
        fmt.Scan(&arr[i])
    }
    for i := 1; i < n - 1; i++ {
        if arr[i] == 0 && arr[i - 1] == 1 && arr[i + 1] == 1 {
            res++
            arr[i - 1] = 0
            arr[i + 1] = 0
        }
    }
    fmt.Println(res)
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var n int64
	scanf("%d\n", &n)
	a := make([]int, n)
	for i := range a {
		scanf("%d", &a[i])
	}

	// 	printf("%v\n", a)
	sw := 0
	for i := 1; i < len(a)-1; i++ {
		if a[i-1] == 1 && a[i] == 0 && a[i+1] == 1 {
			a[i+1] = 0
			sw++
		}
	}
	printf("%d", sw)
}

package main

import (
    "fmt"
    "bufio"
    "os"
)

func IsDisturbed(loc int, arr []int) bool {
    if loc > 0 && loc < len(arr) - 1 &&
        arr[loc] == 0 && arr[loc-1] == 1 && arr[loc+1] == 1 {
        return true
    }

    return false
}

func main() {
    stdin := bufio.NewReader(os.Stdin)

    var n int
    fmt.Fscan(stdin, &n)
    var a []int = make([]int, n)
    for i := 0; i < n; i++ {
        fmt.Fscan(stdin, &a[i])
    }

    var cnt int = 0
    for i := 1; i < n - 1; {
        if IsDisturbed(i, a) {
            if IsDisturbed(i + 2, a) {
                i += 2
            }
            cnt++
        }
        i++
    }

    fmt.Println(cnt)
}

// Codeforces 1077 B Disturbed People train
package main

import (
	"bufio"
	"fmt"
	"strings"
	"strconv"
	"os"
)
var in *bufio.Reader

func readFive() (int,int,int,int,int) {
	var a [5]int
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("first read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for i:=0; i<len(ss); i++ {
		a[i], err = strconv.Atoi(ss[i])
		if err != nil {
			fmt.Println("n atoi failure", err)
			panic(err)
		}
	}
	return a[0],a[1],a[2],a[3],a[4]
}

func readLineNumbs(n int) []int {
	a := make([]int, n)
	s, err := in.ReadString('\n')
	if err != nil {
		fmt.Println("read failure", err)
		panic(err)
	}
	ss := strings.Split(strings.Trim(s, " \n\r"), " ")
	for j:=0; j<n; j++ {
		aa,err := strconv.Atoi(ss[j])
		if err != nil {
			fmt.Println("aa conv failed", err)
			panic(err)
		}
		a[j] = aa
	}
	return a
}

var n int
var a []int
var di []bool
var mink int
var ii int

func readData() {
	in = bufio.NewReader(os.Stdin)
	// reading n, k
	n, _, _, _, _ = readFive()
	// reading a
	a = readLineNumbs(n)
}

func diNext() bool {
	return ii<n-1 && di[ii+1]
}
func diPrev() bool {
	return ii>0 && di[ii-1]
}

func solve() {
	// prepare disturbed
	di = make([]bool, n)
	for i:=0; i<n; i++ {
		if i>0 && i<n-1 && a[i-1]==1 && a[i+1]==1 && a[i]==0 {
			di[i] = true
		}
	}
	//fmt.Println("di:", di)
	// Cl - clear before, Ncl - not cleared before, d b Ncl<=Cl
	minkCl,minkNcl := 0,0
	for ii=0; ii<n; ii++ {
		if a[ii] != 1 {
			continue
		}
		if diNext() && !diPrev() {
			// before disturbed
			minkCl++
		} else if !diNext() && diPrev() {
			minkNcl = minkCl
		} else if diNext() && diPrev() {
			oCl := minkCl
			minkCl = minkNcl+1
			minkNcl = oCl
		} else {
			// do nothing
		}
		//fmt.Printf("ii,prev,next = %d %v %v Cl,Ncl = %d %d\n", ii,diPrev(),diNext(),minkCl,minkNcl)
	}
	mink = minkCl
}

func printRes() {
	fmt.Println(mink)
}

func main() {
	readData()
	solve()
	printRes()
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var apt int
	fmt.Fscanf(reader, "%d\n", &apt)

	apts := make([]int, apt)
	for i := 0; i < apt; i++ {
		fmt.Fscan(reader, &apts[i])
	}
	var count int
	for i := 1; i < apt-1; i++ {
		if apts[i] == 0 && apts[i+1] == apts[i-1] && apts[i-1] == 1 {
			count, apts[i+1] = count+1, 0
		}
	}

	fmt.Println(count)
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func init() {
	scanner.Split(bufio.ScanWords)
}

func scanString() string {
	scanner.Scan()
	return scanner.Text()
}

func scanBytes() []byte {
	scanner.Scan()
	return scanner.Bytes()
}

func scanInt64() int64 {
	scanner.Scan()
	v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return v
}

func scanInt() int {
	scanner.Scan()
	v, _ := strconv.Atoi(scanner.Text())
	return v
}

func scanInts(n int) []int {
	l := make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.Atoi(scanner.Text())
	}

	return l
}

func scanInts64(n int64) []int64 {
	l := make([]int64, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		l[i], _ = strconv.ParseInt(scanner.Text(), 10, 64)
	}

	return l
}

func scanBool() bool {
	scanner.Scan()
	v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
	return v == 1
}

func scanBools(n int64) []bool {
	l := make([]bool, n)
	for i := int64(0); i < n; i++ {
		scanner.Scan()
		v, _ := strconv.ParseInt(scanner.Text(), 10, 64)
		l[i] = v == 1
	}

	return l
}

func main() {
	n := scanInt()
	s := scanBools(int64(n))

	cnt := 0
	for i := 2; i < n; i++ {
		if s[i-2] && !s[i-1] && s[i] {
			s[i] = false
			cnt++
		}
	}

	fmt.Println(cnt)
}

func abs(a int64) int64 {
	if a >= 0 {
		return a
	}

	return -a
}

func min(a, b int64) int64 {
	if a < b {
		return a
	}

	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}

	return b
}

package main

import (
	"bufio"
	"fmt"
	"os"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var n int64
	scanf("%d\n", &n)
	a := make([]int, n)
	for i := range a {
		scanf("%d", &a[i])
	}

	// 	printf("%v\n", a)
	sw := 0
	for i := 1; i < len(a)-2; i++ {
		if a[i-1] == 1 && a[i] == 0 && a[i+1] == 1 {
			a[i+1] = 0
			sw++
		}
	}
	printf("%d", sw)
}