def max_neghbours(size):
... array = [random.randint(1,100) for _ in range(size)]
... print(array)
... max_value = max(array)
... max_value_index = array.index(max_value)
... if max_value_index == 0:
... return array[1]
... elif max_value_index == len(array)-1:
... return array[-2]
... else:
... return array[max_value_index-1] + array[max_value_index+1]