#include<stdio.h>

int main(){

	int n,i,max,min,temp1,temp2;
	int total;
	int s[20];

	while(1){
		scanf("%d",&n);

		scanf("%d",&s[0]);
		max=min=s[0];

		for(i=1;i<n;i++){
			scanf("%d",&s[i]);
			if(s[i]>max){
				max=s[i];
				temp1=i;
			}
			if(s[i]<min){
				min=s[i];
				temp2=i;
			}
		}

		s[temp1]=s[temp2]=total=0;

		for(i=0;i<n;i++){
			total= total+s[i];
		}
		total=total/(n-2);

		printf("%d\n",total);
	}
}