import java.util.Scanner;
import java.lang.Math;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int n = in.nextInt();
int[] a=new int[n];
int min=100,max=0,sum=0;
for(int i=0;i<n;i++){
a[i]=in.nextInt();
max=(max<a[i])?a[i]:max;
min=(min>a[i])?a[i]:min;
sum+=a[i];
}
System.out.printf("%.2f",(sum-max-min)*1.0/(n-2));
System.out.println();
}
}
}
import java.lang.Math;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNext()) {
int n = in.nextInt();
int[] a=new int[n];
int min=100,max=0,sum=0;
for(int i=0;i<n;i++){
a[i]=in.nextInt();
max=(max<a[i])?a[i]:max;
min=(min>a[i])?a[i]:min;
sum+=a[i];
}
System.out.printf("%.2f",(sum-max-min)*1.0/(n-2));
System.out.println();
}
}
}