#include<cstdio> int recursiveMax(int *arr, int left, int right) { if (left == right) return arr[left]; int middle = left + ((right - left) >> 1); int leftVal = recursiveMax(arr, left, middle); int rightVal = recursiveMax(arr, middle + 1, right); return leftVal > rightVal ? leftVal : rightVal; } int main() { int n; scanf("%d", &n); int arr[n]; for (int i = 0; i < n; ++i) scanf("%d", &arr[i]); printf("%d", recursiveMax(arr, 0, n - 1)); return 0; }