fork download
  1. # your code goes here
  2. n=int(input())
  3. a=[]
  4. for i in range(n):
  5. a.append(int(input())*2)
  6.  
  7. p=0
  8. i=-2*a[0]
  9. while i<2*a[0]:
  10. j=i
  11. while j<2*a[0]:
  12. if (i+j)==a[0]:
  13. y=j
  14. l=1
  15. while l<n:
  16. z=a[l]-y
  17. if z<y:
  18. break
  19. y=z
  20. l+=1
  21. if l==n:
  22. p+=1
  23. j+=1
  24.  
  25. i+=1
  26.  
  27. print p
  28.  
Success #stdin #stdout 0s 9032KB
stdin
3
2
5
9
stdout
4