#include <bits/stdc++.h>   using namespace std;   long long mod = 1000000007;   long long power(long long n, long long k) {     long long ans = 1;     while (k) {       if (k & 1) ans = (ans * n) % mod;       k /= 2;       n = (n * n) % mod;     }     return ans;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     int ar[n];     for (int i = 0; i < int(n); i++) cin >> ar[i];     int l[n], r[n], m[n];     l[0] = 1;     for (int i = 1; i < int(n); i++) l[i] = min(ar[i], l[i - 1] + 1);     r[n - 1] = 1;     for (int i = n - 2; i > -1; i--) r[i] = min(r[i + 1] + 1, ar[i]);     int ans = 0;     for (int i = 0; i < int(n); i++) {       m[i] = min(l[i], r[i]);       ans = max(ans, m[i]);     }     cout << ans;     return 0;   }   