def build_(tree(arr):
           n=len(arr)
           tree=[float('int')]*(4*n)

           def build (v,t1,tr):
           if t1==tr:
           tree[v]=arr(t1)
           else:
           tm=(t1+tr)//2
           build(2*v, t1,tm)
           build(2*v+1,tm+1,tv)
           tree[v]=min(tree(2*v)
                       tree[2*v+1])
           build(1,b,n-1)
           return tree
           def restore_array(tree,v,t1,tr)
           if t1==tr:
           return[tree[v]]
           tm=(t1+tr)//2
           left=restore_array(tree,2*v,t1,tm)
           right=restore_array(tree,2*v+1,tm+1,tr)
           return left+right
           values in_tree=[3,2,1,4]
           tree=build_tree(values_in_tree)
           restored_array=restore_array(tree,1,0,len(values_in_tree)-1)
           len((values_in_tree)-1)
           print(restored_array)
