#include <iostream>
#include<stdlib.h>
using namespace std;
static int cnt;
int compare( const void * a, const void * b)
{
int l = * ( int * ) a;
int r= * ( int * ) b;
cout << "compare " << l<< " with " << r<< endl;
return l- r;
}
int main( ) {
// your code goes here
int a[ ] = { 10 ,9 ,8 ,7 ,6 ,5 } ;
int size= sizeof ( a) / sizeof ( a[ 0 ] ) ;
int i;
qsort ( a,size,sizeof ( int ) ,compare) ;
for ( i= 0 ; i< 6 ; i++ )
cout << a[ i] << " " ;
cout << endl<< cnt<< endl;
return 0 ;
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgICNpbmNsdWRlPHN0ZGxpYi5oPgogICAgdXNpbmcgbmFtZXNwYWNlIHN0ZDsKICAgICAKICAgIHN0YXRpYyBpbnQgY250OwogICAgIAogICAgaW50IGNvbXBhcmUoY29uc3Qgdm9pZCAqYSwgY29uc3Qgdm9pZCAqYikKICAgIHsKICAgIGludCBsID0gKihpbnQqKWE7CiAgICBpbnQgcj0gKihpbnQqKWI7CiAgICBjb3V0PDwiY29tcGFyZSAiPDxsPDwiIHdpdGggIjw8cjw8ZW5kbDsKICAgIHJldHVybiBsLXI7CiAgICB9CiAgICAgCiAgICBpbnQgbWFpbigpIHsKICAgIC8vIHlvdXIgY29kZSBnb2VzIGhlcmUKICAgIGludCBhW109IHsxMCw5LDgsNyw2LDV9OwogICAgaW50IHNpemU9IHNpemVvZihhKS9zaXplb2YoYVswXSk7CiAgICBpbnQgaTsKICAgIHFzb3J0KGEsc2l6ZSxzaXplb2YoaW50KSxjb21wYXJlKTsKICAgICAKICAgIGZvcihpPTA7aTw2O2krKykKICAgIGNvdXQ8PGFbaV08PCIgIjsKICAgICAKICAgIGNvdXQ8PGVuZGw8PGNudDw8ZW5kbDsKICAgIHJldHVybiAwOwogICAgfQ==