#include <iostream>
#include <vector>
using namespace std;
int main() {
setlocale(0, "");
vector<int> arr;
cout << "Количество чисел: n";
int n, temp, min = 2147483647, max = -2147483648, minIndex = 0, maxIndex = 0;
long long sum = 0;
cin >> n;
for (int i = 1; i <= n; ++i) {
cout << i - 1 << ": ";
cin >> temp;
arr. push_back(temp);
if (temp < min)
(min = temp) && (minIndex = i - 1);
if (temp > max)
(max = temp) && (maxIndex = i - 1);
}
cout << "Минимальный элемент: " << min << ", располагается по индексу " << minIndex << endl;
cout << "Максимальный элемент: " << max << ", располагается по индексу " << maxIndex << endl;
for (int i = minIndex + 1; i < maxIndex; ++i)
sum += arr[i];
cout << "Сумма элементов с " << minIndex + 1 << " по " << maxIndex - 1 << " включительно: " << sum << endl;
cout << "Среднее значение элементов с " << minIndex + 1 << " по " << maxIndex - 1 << " включительно: " << sum / (maxIndex - minIndex - 1) << endl;
return 0;
}