fork download
  1. count_room = int(input())
  2. tea = list(map(int,input().split()))
  3. max_happy = 0
  4. for i in range(count_room-1):
  5. if ((tea[i] - 1)*(tea[i+1] - 1)) > max_happy:
  6. max_happy = (tea[i] - 1)*(tea[i+1] - 1)
  7. print(max_happy)
  8.  
  9.  
  10.  
Success #stdin #stdout 0.03s 9248KB
stdin
5
10 2 5 2 8

stdout
9