#include <stdio.h> int main() { int n; while ((scanf("%d", &n)) != EOF) { int Arr[n]; for (int i = 0; i < n; i++) { scanf("%d", &Arr[i]); } int Brr[n]; int k = 0; for (int j = 0; j < n; j++) { if (j == 0 && (Arr[j] != Arr[j + 1])) { Brr[k++] = j; } else if (j == n - 1 && (Arr[j] != Arr[j - 1])) { Brr[k++] = j; } else if ((Arr[j] > Arr[j + 1] && Arr[j] > Arr[j - 1]) || (Arr[j] < Arr[j + 1] && Arr[j] < Arr[j - 1])) { Brr[k++] = j; } } for (int l = 0; l < k; l++) { printf("%d ", Brr[l]); } printf("\n"); } return 0; }