n = int(input()) a = list(map(int, input().split())) ans = 0 for i in range(1, n - 1): if (a[i - 1] > a[i] < a[i + 1]): left = i while(left > 0): if (a[left - 1] > a[left]): left -= 1 else: break right = i while (right < n - 1): if (a[right] < a[right + 1]): right += 1 else: break ans = max(right - i, i - left) elif (a[i - 1] < a[i] > a[i + 1]): left = i while(left > 0): if (a[left - 1] < a[left]): left -= 1 else: break right = i while (right < n - 1): if (a[right] > a[right + 1]): right += 1 else: break ans = max(right - i, i - left) print(ans)