public void solve() throws IOException {
    int n = nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) {
      a[i] = nextInt();
    }
    
    int max = 0;
    int index = -1;
    for (int i = 0; i < n - 1; i++) {
      int decrease = a[i + 1] - a[i];
      if (i > 0) {
        int oldup = Math.max(0, a[i] - a[i - 1]);
        int newup = Math.max(0, a[i + 1] - a[i - 1]);
        decrease += oldup - newup;
      }
      
      if (i + 2 < n) {
        int oldup = Math.max(0, a[i + 2] - a[i + 1]);
        int newup = Math.max(0, a[i + 2] - a[i]);
        decrease += oldup - newup;
      }
      
      if (decrease > max) {
        max = decrease;
        index = i + 1;
      }
    }
    
    System.out.println(index);
  }