#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>
int main()
{
std::cout << "How many values do you want to enter?" << std::endl;
unsigned n;
std::cin >> n;
std::vector<float> values(n);
std::cout << "Enter " << n << " values:" << std::endl;
std::copy_n(std::istream_iterator<float>(std::cin), n, values.begin());
std::cout << "Average of values is " <<
( std::accumulate(values.begin(), values.end(), 0.0) / n ) << std::endl;
auto minmax = std::minmax_element(values.begin(), values.end());
std::cout << "Minimum is " << *minmax.first << std::endl;
std::cout << "Maximum is " << *minmax.second << std::endl;
std::cout << "Range is " << *minmax.second - *minmax. first;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aXRlcmF0b3I+CiNpbmNsdWRlIDx2ZWN0b3I+CgoKaW50IG1haW4oKQp7CiAgICBzdGQ6OmNvdXQgPDwgIkhvdyBtYW55IHZhbHVlcyBkbyB5b3Ugd2FudCB0byBlbnRlcj8iIDw8IHN0ZDo6ZW5kbDsKICAgIHVuc2lnbmVkIG47CiAgICBzdGQ6OmNpbiA+PiBuOwogICAgc3RkOjp2ZWN0b3I8ZmxvYXQ+IHZhbHVlcyhuKTsKICAgIHN0ZDo6Y291dCA8PCAiRW50ZXIgIiA8PCBuIDw8ICIgdmFsdWVzOiIgPDwgc3RkOjplbmRsOwogICAgc3RkOjpjb3B5X24oc3RkOjppc3RyZWFtX2l0ZXJhdG9yPGZsb2F0PihzdGQ6OmNpbiksIG4sIHZhbHVlcy5iZWdpbigpKTsKICAgIHN0ZDo6Y291dCA8PCAiQXZlcmFnZSBvZiB2YWx1ZXMgaXMgIiA8PAogICAgICAgICAgICAgICAgKCBzdGQ6OmFjY3VtdWxhdGUodmFsdWVzLmJlZ2luKCksIHZhbHVlcy5lbmQoKSwgMC4wKSAvIG4gKSA8PCBzdGQ6OmVuZGw7CiAgICBhdXRvIG1pbm1heCA9IHN0ZDo6bWlubWF4X2VsZW1lbnQodmFsdWVzLmJlZ2luKCksIHZh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