#include <iostream> #include <vector> using namespace std; void isPeak(vector<int> a, int index) { if (index != 0 && index != a.size() - 1) { if (a[index] > a[index + 1] && a[index] > a[index - 1]) cout << index << " "; if (a[index] < a[index + 1] && a[index] < a[index - 1]) cout << index << " "; } else { if (index == 0 && a[0] != a[1]) cout << "0 "; if (index == a.size() - 1 && a[a.size() - 1] != a[a.size() - 2]) cout << a.size() - 1; } } int main() { int k; while (cin >> k) { vector<int> arr(k); for (int i = 0; i < arr.size(); i++) cin >> arr[i]; for (int i = 0; i < arr.size(); i++) { isPeak(arr, i); } cout << endl; } }