#include #include using namespace std; int n,x,res,a,b; int main() { while(scanf("%d",&n)==1&&n) { priority_queue,greater > q; for(int i=0;i