Problem:
 Score : 700 points    Problem Statement N people are waiting in a single line in front of the Takahashi Store. The cash on hand of the i -th person from the front of the line is a positive integer A_i .  Mr. Takahashi, the shop owner, has decided on the following scheme: He picks a product, sets a positive integer P indicating its price, and shows this product to customers in order, starting from the front of the line. This step is repeated as described below.  At each step, when a product is shown to a customer, if price P is equal to or less than the cash held by that customer at the time, the customer buys the product and Mr. Takahashi ends the current step. That is, the cash held by the first customer in line with cash equal to or greater than P decreases by P , and the next step begins.  Mr. Takahashi can set the value of positive integer P independently at each step.  He would like to sell as many products as possible. However, if a customer were to end up with 0 cash on hand after a purchase, that person would not have the fare to go home. Customers not being able to go home would be a problem for Mr. Takahashi, so he does not want anyone to end up with 0 cash.  Help out Mr. Takahashi by writing a program that determines the maximum number of products he can sell, when the initial cash in possession of each customer is given.      Constraints  1 ≦ | N | ≦ 100000  1 ≦ A_i ≦ 10^9(1 ≦ i ≦ N)  All inputs are integers.         Input Inputs are provided from Standard Inputs in the following form.  N  A_1 : A_N       Output Output an integer representing the maximum number of products Mr. Takahashi can sell.        Sample Input 1 3
3
2
5      Sample Output 1 3  As values of P , select in order 1, 4, 1 .       Sample Input 2 15
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9      Sample Output 2 18

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    A=[int(input()) for _ in range(n)]

    
    ans=A[0]-1
    p=2
    
    
    for a in A[1:]:
        if(a<p): 
            continue
        elif(a==p):
            p+=1
        else:
            ans+=(a-1)//p
    print(ans)
resolve()

Solution (Python):
def main():
    n=int(input())
    a=[int(input()) for _ in [0]*n]
    cnt=a[0]-1
    now=2
    for i in range(1,n):
        if a[i]==now:
            now+=1
        elif a[i]>now:
            cnt+=(a[i]-1)//now
    print(cnt)
main()

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]

ret = A[0] - 1
M = 2
for i in range(1, N) :
    if A[i] < M :
        continue
        
    if A[i] == M :
        M += 1
    else :
        ret += (A[i] - 1) // M
        
print(ret)

Solution (Python):

from collections import defaultdict


def getlist():
	return list(map(int, input().split()))


def main():
	N = int(input())
	ans = 0
	c = 1
	a = int(input())
	ans += a - 1
	for i in range(N - 1):
		a = int(input())
		if a == c + 1:
			c += 1
		elif a > c + 1:
			if (a - c - 1) % (c + 1) == 0:
				ans += (a - c - 1) // (c + 1)
			else:
				ans += (a - c - 1) // (c + 1) + 1
	print(ans)

if __name__ == '__main__':
	main()

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]
ans = A[0]-1
mi = 2
for a in A[1:]:
    if mi > a:
        continue
    elif mi == a:
        mi += 1
    else:
        ans += (a-1) // mi
print(ans)

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]
"""
this is wrong answer!!
dp = [[[0, 0], [0, 0]] for _ in range(N)]
dp[0][0][0] = 2
dp[0][1][0] = 2
dp[0][0][1] = A[0]-1
dp[0][1][1] = A[0]-1
for i in range(1, N):
    for l in [0, 1]:
        remove = A[i] // dp[i-1][l][0]
        if A[i] % dp[i-1][l][0] == 0:
            if dp[i][1][1] < dp[i-1][l][1] + remove - 1:
                dp[i][1][1] = dp[i-1][l][1] + remove - 1
                dp[i][1][0] = dp[i-1][l][0] + 1
            if dp[i][0][1] < dp[i-1][l][1] + remove - 2:
                dp[i][0][1] = dp[i-1][l][1] + remove - 2
                dp[i][0][0] = dp[i-1][l][0]
        else:
            if dp[i][1][1] < dp[i-1][l][1] + remove:
                dp[i][1][1] = dp[i-1][l][1] + remove
                dp[i][1][0] = dp[i-1][l][0]
                dp[i][0][1] = dp[i][1][1]
                dp[i][0][0] = dp[i][1][0]
ans = max(dp[N-1][0][1], dp[N-1][1][1])
print(ans)
"""

p = 2
ans = A[0]-1
for i in range(1, N):
    if p == A[i]:
        p += 1
    else:
        if A[i] % p == 0:
            ans += A[i]//p-1
        else:
            ans += A[i]//p
print(ans)

Solution (Python):
import sys
input = sys.stdin.buffer.readline

N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

p = 2
ans = a[0] - 1
for i in range(1, N):
    if a[i] == p:
        p += 1
    ans += ((a[i]-1)//p)

print(ans)

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]
k = 2
ans = A[0] - 1
for i in range(1, N):
    if A[i] == k:
        k += 1
    elif A[i] > k:
        ans += (A[i] - 1) // k
print(ans)

Solution (Python):

N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
MAX = 1

for i in range(N):
    if i == 0:
        ans+=A[0]-1
        now = 2
    else:
        if A[i] == now:
            now+=1
            continue
        if A[i]%now == 0:
            ans+=(A[i]//now)-1
        else:
            ans+=A[i]//now
            
print(ans)

Solution (Python):
n,*a=map(int,open(0))
b,c=1,0
for i in a:
  c+=~-i//b*(i>b)
  b+=b<2or i==b
print(c)

Solution (Python):
n,*a=map(int,open(0))
b,c=1,0
for i in a:
  if i>b:
    c+=(i-1)//b
    b+=b<2
  elif i==b:
    b+=1
print(c)

Solution (Python):
n,*a=map(int,open(0))
b,c=1,0
for i in a:
  if i>b:
    c+=(i-1)//b
    b+=b<2
  elif i==b:
    b+=1
print(c)

Solution (Python):
n,*a=map(int,open(0))
b=c=0
for i in a:
  if b<1:
    c+=i-1
    b=2
  elif i>b:
    c+=(i-1)//b
  elif i==b:
    b+=1
print(c)

Solution (Python):
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)

from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque



def main():
    num = int(input())
    data = [int(input()) for i in range(num)]

    money = 0
    ans = 0
    for i in range(num):
        now_num = data[i]
        if money == 0:
            ans += now_num - 1
            money = 1
        else:
            if now_num > money + 1:
                kari = math.ceil((now_num - money - 1) / (money + 1))
                ans += kari
                now_num = money
            money = max(now_num, money)
        

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(N)]

ans = A[0] - 1
p = 2
for a in A[1:]:
    if a > p:
        ans += (a - 1) // p
    if a == p:
        p += 1
print(ans)

Solution (Python):
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
P = 1

for i, a in enumerate(A):
    if i == 0:
        ans += (a - 1) // P
        P += 1
        continue

    if a < P:
        continue

    if a == P:
        P += 1
        continue

    ans += (a - 1) // P

print(ans)

Solution (Python):
import sys
input=sys.stdin.readline
N=int(input())
A=[int(input()) for i in range(N)]

ans=0
ans+=(A[0]-1)

S=2
for i in range(1,N):
    if A[i]>=S+1:
        ans+=(A[i]-1)//S
    elif A[i]==S:
        S+=1
    elif A[i]<S:
        continue
print(ans)

Solution (Python):
N=int(input())
A=[int(input()) for i in range(N)]
x,r=0,0
for a in A:
    d=(a-1)//(x+1)
    if d==0:
        x=max(a,x)
    elif x==0:
        x=1
    r+=d
print(r)

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]

last_n = 1
cnt = 0
for ind,a in enumerate(A):
    if(a==last_n):
        last_n += 1
        continue
    n = (a-1)//last_n
    if(ind==0):
        last_n += 1
    cnt += n
print(cnt)

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]

ans = A[0] - 1

nowMin = 1
for a in A[1:]:
    if a == nowMin + 1:
        nowMin = a
    else:
        q, r = divmod(a, nowMin + 1)
        if r == 0:
            q -= 1
        ans += q

print(ans)

Solution (Python):
n = int(input())
a = [int(input()) for i in range(n)]
ans = 0
now = 1
for i in a:
    if i == now:
        now += 1
    if i < now:
        continue
    if i%now == 0:
        ans += i//now-1
    else:
        ans +=  i//now
    if now == 1:
        now += 1
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

n = getN()
nums = []

for i in range(n):
    nums.append(getN())

cur_max = 1
ans = nums[0] - 1

for num in nums[1:]:
    if num <= cur_max:
        pass
    elif num == cur_max + 1:
        cur_max += 1
    else:
         ans += (num - cur_max - 2) // (cur_max + 1) + 1

    

print(ans)
"""
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9
1 1 4 1 5 9 2 6 5 3 5 8 9 7 9 (2)
1 1 1 1 5 9 2 6 5 3 5 8 9 7 9 (3)
1 1 1 1 1 9 2 6 5 3 5 8 9 7 9 (5)
1 1 1 1 1 1 2 6 5 3 5 8 9 7 9 (9)
1 1 1 1 1 1 2 2 5 3 5 8 9 7 9 (10)
1 1 1 1 1 1 2 2 2 3 5 8 9 7 9 (11)
1 1 1 1 1 1 2 2 2 3 1 1 1 1 1 (18)
"""

Solution (Python):



import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
a = [I() for _ in range(n)]
tmp = 1
ans = a[0] - 1
for i in range(1,n):
    if a[i] == tmp + 1:
        tmp += 1
    elif a[i] == tmp:
        continue
    else:
        ans += math.ceil(a[i]/(tmp+1)) - 1
print(ans)

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

a = [onem() for i in range(n)]

ans = a[0] - 1

i = 1
co = 2
while i != n:
    if a[i] == co:
        co += 1
        i += 1
    else:
        if a[i] > co:
            if a[i] % co == 0:
                ans += a[i]//co - 1
            else:
                ans += a[i]//co
        i += 1



print(ans)

Solution (Python):
N = int(input())
A = [0] * N
Z = 0
cnt = 0
for i in range(N):
  a = int(input())
  if a > Z + 1:
    z = (a - 1) // (Z + 1)
    cnt += z
    a = 1
  Z = max(a, Z)
print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = [int(input()) for _ in range(N)]

p = 1
answer = 0
for a in A:
    if a == p:
        p += 1
        continue
    answer += (a-1)//p
    if p == 1:
        p += 1

print(answer)

Solution (Python):
N=int(input())
A=[int(input()) for _ in range(N)]
max_rem=0
ans=0
for a in A:
    if a >= max_rem+2:
        h = max_rem+1
        if a%h == 0:
            ans += (a//h-1)
            if max_rem==0:
                max_rem=1
        else:
            ans += (a//h)
    else:
        max_rem = max(max_rem, a)
print(ans)

Solution (Python):
N = int(input())
A = [int(input()) for _ in [0]*N]

ans = A[0]-1
m = 2
for a in A[1:]:
    if a==m: m+=1
    elif a>m: ans += a//m-(a%m==0)
print(ans)

Solution (Python):
n=int(input())
a=[int(input())for i in range(n)]
c=0
b=1
d=0
while c<n:
    if a[c]==b:
        b+=1
        c+=1
    else:
        if a[c]%b==0:
            d+=((a[c]-2-b)//b+1if b!=1 else a[c]-1)
            c+=1
            b+=(1 if b==1 else 0)
        else:
            d+=a[c]//b
            c+=1
print(d)

Solution (Python):
N = int(input())
p = 1
num = 0
for i in range(N):
    a = int(input())
    if i == 0:
        num += a - 1
    elif a == p + 1:
        p += 1
    elif a > p + 1:
        num += (a - 1) // (p + 1)

print(num)

Solution (Python):
def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    ans = A[0] - 1
    mn = 2
    for a in A[1:]:
        use = (a - 1) // mn
        if use == 0:
            mn = max(mn, a+1)
        ans += use
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = [int(input()) for i in range(N)]

current = 2
count = A[0]-1
for i in range(1,N):
    if current==A[i]:
        current+=1
    else:
        count+=(A[i]-1)//current

print(count)

Solution (Python):
import sys
input=sys.stdin.readline
n=int(input())
A=[int(input()) for _ in range(n)]
ans=A[0]-1
cnt=2
for i,a in enumerate(A[1:]):
    if a<cnt:
        continue
    if a==cnt:
        cnt+=1
    else:
        ans+=(a-1)//cnt
print(ans)

Solution (Python):
import sys
N = int(input())
if N == 1:
    print(int(input()) - 1)
    sys.exit()

A = [int(sys.stdin.readline()) for _ in range(N)]
ans = A[0] - 1
i = 2

for a in A[1:]:
    if i == a:
        i += 1
        continue
    ans += (a-1)//i
print(ans)

Solution (Python):
n = int(input())
a = [int(input()) for i in range(n)]
a = a[::-1]

ans = 0
num = 1

while a:
    if a[-1] < num:
        del a[-1]
    elif a[-1] == num:
        num += 1
    elif a[-1] > num:
        if a[-1] % num == 0:
            ans += a[-1] // num - 1
            a[-1] = 1
        else:
            ans += a[-1] // num
            a[-1] = 1

print(ans)

Solution (Python):
N=int(input())
A=[int(input()) for i in range(N)]
Max=0
ans=0
for i in range(N):
  if Max+1<A[i]:
    if A[i]%(Max+1):
      ans+=A[i]//(Max+1)
      A[i]=1
    else:
      ans+=A[i]//(Max+1)-1
      A[i]=1
  Max=max(Max,A[i])
  
print(ans)

Solution (Python):
n = int(input())
a = [int(input()) for i in range(n)]
p = 2
ans = a[0]-1
for i in range(1,n):
  if a[i] > p: ans+= (a[i]-1)//p
  elif a[i] == p: p += 1
print(ans)

Solution (Python):
N=int(input())
A=[int(input()) for i in range(N)]
t=1
ans=A[0]-1
A[0]=1
for i in range(1,N):
    if A[i]==t+1:
        t+=1
        continue
    if A[i]%(t+1)==0 and A[i]>(t+1):
        A[i]-=(t+2)
        ans+=1
    ans+=A[i]//(t+1)
    A[i]=A[i]-(A[i]//(t+1))*(t+1)
print(ans)

Solution (Python):
N = int(input())
A = [int(input()) for i in range(N)]
min_v = 1
ans = 0
for a in A:
    if a == min_v:
        min_v += 1
    elif a > min_v:
        d = (a-1)//min_v
        ans += d
        if a - d*min_v == min_v == 1:
            min_v += 1
print(ans)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
aa = [int(input()) for i in range(N)]

ans = aa[0]-1
tmp = 2
for i in range(1,N):
	a = aa[i]
	if a > tmp:
		ans += (a-1)//tmp
	elif a == tmp:
		tmp += 1

print(ans)

Solution (Python):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

bottom = 2
res = a[0]-1

for i in range(1,n):
    if a[i] == bottom: bottom=a[i]+1
    b = (a[i] - 1) // bottom
    res += b


print(res)

Solution (Python):
N = int(input())
A = [int(input()) for i in range(N)]
V = 1
ans = 0
for i in range(N):
    
    if(A[i] > V):
        t = (A[i]-1)//V
        ans += t
        A[i] -= V*t
        if(A[i]+1 > V):
            A[i] = 1
    V = max(V,A[i]+1)
    
print(ans)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
gosa = 1.0 / 10**10
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    a = [I() for _ in range(n)]
    t = 1
    r = a[0] - 1
    for c in a[1:]:
        if c > t+1:
            r += (c-t-2) // (t+1) + 1
        elif c == t+1:
            t = c

    return r


print(main())

Solution (Python):
def main():
    n = int(raw_input())
    a = [int(raw_input()) for _ in xrange(n)]
    
    plen = 0
    maxa = 0
    for amt in a:
        minp = maxa + 1
        items = (amt - 1) / minp
        
        
        plen += items
        if items > 0:
            
            rem = 1
        else:
            rem = amt
        maxa = max(maxa, rem)
    
    
    
    print plen
main()

Solution (Python):
n=int(input())
m1=int(input())
ans=m1-1
cur=2
for i in range(n-1):
    m=int(input())
    if m==cur:
        cur+=1
    ans+=(m-1)//cur
print(ans)

Solution (Python):
N = int(raw_input())
res = 0
q = 1
 
for i in range(N):
    m = int(raw_input())
    res += int((m-1)/q)
    if q == 1 or m == q:
        q += 1
print res

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]

now = 2
ans = 0
for i, a in enumerate(A):
    if i == 0:
        ans += a - 1
    else:
        if a > now:
            ans += (a - 1) // now
        elif a == now:
            now = a + 1
print(ans)

Solution (Python):
n = int(raw_input())
a = []
t = 1
count = 0
for i in xrange(n):
    a.append(int(raw_input()))
for v in a:
    if t == 1:
        count += v - 1
        t += 1
    elif v > t:
        if v % t == 0:
            count += v / t - 1
        else:
            count += v / t
    elif v == t:
        t += 1
print count

Solution (Python):



n = int(input())
arr = [int(input()) for i in range(n)]
count = arr[0]-1
m = 2
for a in arr[1:]:
    if a > m:
        count += (a - 1) // m
    if a == m:
        m += 1
print(count)

Solution (Python):



n = int(input())
arr = []
for i in range(n):
    arr.append(int(input()))
count = max(arr[0]-1,0)
index = 2
for i in range(1,n):
    if arr[i] > index:
        count += (arr[i] - 1) // index
    if arr[i] == index:
        index += 1
print(count)

Solution (Python):
N = int(input())
A = []
for i in range(N):
	A.append(int(input()))
c = 0
sold = 0
i = 0
while i<len(A):
	if A[i] == c+1:
		i+=1
		c+=1
	elif A[i]<=2*(c+1) and A[i]>c+1:
		i+=1
		sold+=1
		if c == 0:
			c = 1
	elif A[i]>2*(c+1) and A[i]>c+1:
		sold+=((A[i]-1)//(c+1))
		i+=1
		if c == 0:
			c = 1
	else:
		i+=1
print(sold)

Solution (Python):
n=int(raw_input())
a=[int(raw_input()) for _ in xrange(n)]
ans=a[0]-1
maxa=2
for i in xrange(1,n):
    if maxa==a[i]:
        maxa=a[i]+1
    else:
        if maxa<a[i]:
            if a[i]%maxa==0:
                ans+=a[i]/maxa-1
            else:
                ans+=a[i]/maxa
print(ans)

Solution (Python):
N = int(raw_input())
A = [int(raw_input()) for i in xrange(N)]
ans = A[0] - 1
d = 2
for i in xrange(1, N):
    ans += (A[i] - 1)/d
    if A[i] == d: d += 1
print ans

Solution (Python):
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n = read()
    a = [read() for _ in range(n)]
    s = 0
    c = 2
    for i in range(n):
        if i == 0:
            s = a[i] - 1
            continue
        x = a[i] // c
        if c == a[i]:
            c += 1
            x = 0
        elif a[i] % c == 0:
            x -= 1
        s += x
    print(s)

main()

Solution (Python):
N=int(input())
a=[0]*N
for i in range(N):
    a[i]=int(input())

minimum=2
count=a[0]-1
a.pop(0)
for i in  a:
   if(minimum<i):
       if i%minimum:
           count+= i//minimum
       else :
           count+= (i//minimum-1)
   else:
       minimum=max(minimum,i+1)
print(count)

Solution (Python):
n = int(raw_input())
a = [int(raw_input()) for i in range(n)]
res = 0
m = 0
for i, e in enumerate(a):
    if e - (m+1) > 0:
        t = e - (m+1)
        if t % (m+1) == 0:
            res += t / (m+1)
            m = min(m, e - t)
        else:
            res += t / (m+1) + 1
    else:
        m = max(e, m)
    if m == 0:
        m += 1
print res

Solution (Python):


N = int(input())
As = []
for i in range(N):
    As.append(int(input()))

mn = 1
ans = 0
for a in As:
    if mn == 1:
        ans += a - 1
        mn = 2
    else:
        if mn == a:
            mn += 1
        else:
            ans += (a - 1) // mn
print(ans)

Solution (Python):
import sys

n = int(input())

ai = []
for i in range(0, n):
    ai.append(int(input()))

count = 0
iter = 0
r = 1

if len(ai) == 1:
    print(ai[0] - 1)
    sys.exit()

while True:
    if iter == 0 and ai[0] > 1:
        count += ai[0] - 1
        ai[0] = 1
    else:
        while ai[iter] <= r + 1:
            r = max(r, ai[iter])
            iter += 1
            if iter >= len(ai):
                print(count)
                sys.exit()
        div = int(ai[iter] / (r + 1))
        mod = ai[iter] % (r + 1)
        if mod == 0:
            count += div - 1
            ai[iter] = 1
        else:
            count += div
            ai[iter] = mod

Solution (Python):
N = input()
maximum = 1
ans = int(raw_input()) - 1
for i in xrange(N-1):
    n = int(raw_input())
    if n <= maximum:
        continue
    if n == maximum + 1:
        maximum += 1
        continue
    ans += (n-1)/(maximum+1)
print ans

Solution (Python):



N = int(input())
A = [0]*N
for i in range(N):
	A[i] = int(input())

ans = A[0] - 1
A[0] = 1

cnt = 1


for i in range(1, N):
	now = A[i]

	if now > cnt:
		if now == cnt + 1: 
			cnt += 1
		else: 
			ans += now // (cnt + 1)
			if now % (cnt + 1) == 0:
				ans -= 1

print(ans)

Solution (Python):



N = int(input())
A = [0]*N
for i in range(N):
	A[i] = int(input())

ans = A[0] - 1
A[0] = 1

cnt = 1


for i in range(1, N):
	now = A[i]

	if now > cnt:
		if now == cnt + 1: 
			cnt += 1
		else: 
			ans += now // (cnt + 1)
			if now % (cnt + 1) == 0:
				ans -= 1

print(ans)

Solution (Python):
now = 2
n = int(raw_input())
a = []
for i in xrange(n):
    p = int(raw_input())
    a.append(p)

res = a[0]-1
a.pop(0)

for x in a:
    if x > now:
        if x % now:
            res += x / now
        else:
            res += x / now - 1
    if x == now:
        now += 1
print res

Solution (Python):
num=input()
a=[]
for i in range(num):
    p=input()
    a.append(p)
ans=a[0]-1
a.pop(0)
nowprice=2
for custom in a:
    if (custom>nowprice):
        if custom % (nowprice)==0:
            ans += custom / (nowprice )-1
        else:
            ans+=custom/(nowprice)
    if (custom==nowprice):
        nowprice+=1
print ans

Solution (Python):
N = int(raw_input())
res = 0
q = 1

for i in range(N):
    m = int(raw_input())
    res += int((m-1)/q)
    if q == 1 or m == q:
        q += 1
print res

Solution (Python):
N =int(input())

A = [int(input()) for _ in range(N)]



def solve(target,min_n):
    if A[target] > min_n:
        return (((A[target]-1)//min_n),max(min_n,2))
    else:
        return (0, max(min_n , A[target]+1))

ans =0
min_n=1
for i in range(N):
    res,min_n =solve(i,min_n)
    
    ans +=res

print(ans)

Solution (Python):
N = int(input())
A = [int(input()) for _ in range(N)]
ans = A[0] - 1
m = 1
for a in A[1:]:
    if a == m + 1:
        m += 1
    else:       
        ans += (a-1) // (m + 1)
print(ans)

Solution (Python):
n = input()
A = [int(raw_input()) for i in xrange(n)]
B = [0]*n

can = 1
ans = 0
for i in xrange(n):
    cnt = (A[i]-1)/can
    ans += cnt
    B[i] = A[i] - cnt*can
    if cnt > 0 and can > 1 and B[i]==can:
        B[i] -= 1
    
    can = max(can, B[i]+1)
print ans

Solution (Python):
N = int(input())
As = [int(input()) for _ in range(N)]

s = As[0]-1
killer = 1
for a in As[1:]:
    if a == killer+1:
        killer = a
    elif a > killer+1:
        s += (a-1)//(killer+1)
print(s)

Solution (Python):

import math,string,itertools,fractions,heapq,collections,re,array,bisect

def s():
    return raw_input().strip()
def n():
    return int(raw_input())
def d():
    return float(raw_input())

def ls():
    return raw_input().strip().split()
def ln():
    return map(int, raw_input().strip().split())
def ld():
    return map(float, raw_input().strip().split())

def fs():
    return [raw_input().strip() for i in xrange(input())]
def fn():
    return [int(raw_input().strip()) for i in xrange(input())]
def fd():
    return [float(raw_input().strip()) for i in xrange(input())]

def eratosthenes_sieve(n):
    table = [0] * (n + 1)
    prime_list = []
    
    for i in xrange(2, n + 1):
        if table[i] == 0:
            prime_list.append(i)
            for j in xrange(i + i, n + 1, i):
                table[j] = 1
    
    return prime_list

def trial_division_sqrt(n):
    prime_count = collections.Counter()
    
    for i in xrange(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n /= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    
    for p, c in prime_count.iteritems():
        prime_count[p] = c % 3
    
    return prime_count

def trial_division_prime(n, prime_list):
    prime_count = collections.Counter()
    
    for i in prime_list:
        if i * i > n:
            break
        while n % i == 0:
            n /= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    
    for p, c in prime_count.iteritems():
        prime_count[p] = c % 3
    
    return prime_count

N = n()

A = []
for i in xrange(N):
    A.append(n())

result = A[0] - 1
th = 2

for a in A[1:]:
    if a > th:
        num = (a - 1) / th
        rest = a - th * num
        a = rest
        result += num
        if rest > th:
            th = rest

    elif a == th:
        th = a + 1






print result

Solution (Python):

import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N = int(raw_input())
A = [int(raw_input()) for i in xrange(N)]
ans = A[0] - 1
d = 2
for i in xrange(1, N):
    k = (A[i] - 1)/d
    if A[i] == d:
        d += 1
    ans += k
print ans