//感觉注释里的代码更对啊
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#define ll long long
using namespace std;
int main()
{
ll n, x;
ll a[1005];
double sum = 0;
double ans;
scanf("%lld", &n);
for (int i = 1; i <= n; ++i)
{
scanf("%lld", &x);
a[i] = x * 1005 + i; //!!
}
sort(a + 1, a + n + 1);
for (int i = 1; i <= n; ++i)
{
printf("%lld ", a[i] % 1005);
sum += a[i] / 1005 * (n - i);
//sum += (a[i] - i) / 1005 * (n - i);
}
printf("\n");
ans = (double)sum / n;
printf("%.2lf", ans);
system("pause");
return 0;
}