#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, mx = -1, mn = 200, mxpos = 0, mnpos = 0;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    if (mx < arr[i]) {
      mx = max(mx, arr[i]);
      mxpos = i;
    }
    if (mn > arr[i]) {
      mn = min(mn, arr[i]);
      mnpos = i;
    }
  }
  cout << max(mxpos - 0,
              max(abs(mxpos - (n - 1)), max(mnpos - 0, abs(mnpos - (n - 1)))));
}
