struct Pair{int first;int second;};
l(a,n,p)int*a;{return n?n<0?a[-n]<p?(((a[-n]^=*a),*a^=a[-n]),a[-n]^=*a),l(a+1,~n,p)+1:l(a,n+1,p):*a<p?l(a+1,n-1,p)+1:l(a,1-n,p):-1;}
struct Pair f(a,n,p)int*a;{struct Pair r={l(a,n,p),l(a,n,p+1)};return r;}
#include <stdio.h>
main() {
int n, p, i;
int a[n];
for(i
=0; i
<n
; i
++) scanf("%d", &a
[i
]); struct Pair r = f(a, n, p);
for(i
=0; i
<n
; i
++) printf("%d ", a
[i
]); printf("\n%d,%d\n", r.
first, r.
second); }
c3RydWN0IFBhaXJ7aW50IGZpcnN0O2ludCBzZWNvbmQ7fTsKCmwoYSxuLHApaW50KmE7e3JldHVybiBuP248MD9hWy1uXTxwPygoKGFbLW5dXj0qYSksKmFePWFbLW5dKSxhWy1uXV49KmEpLGwoYSsxLH5uLHApKzE6bChhLG4rMSxwKToqYTxwP2woYSsxLG4tMSxwKSsxOmwoYSwxLW4scCk6LTE7fQpzdHJ1Y3QgUGFpciBmKGEsbixwKWludCphO3tzdHJ1Y3QgUGFpciByPXtsKGEsbixwKSxsKGEsbixwKzEpfTtyZXR1cm4gcjt9CgojaW5jbHVkZSA8c3RkaW8uaD4KbWFpbigpIHsKICBpbnQgbiwgcCwgaTsKICBzY2FuZigiJWQlZCIsICZuLCAmcCk7CiAgaW50IGFbbl07CiAgZm9yKGk9MDsgaTxuOyBpKyspIHNjYW5mKCIlZCIsICZhW2ldKTsKICBzdHJ1Y3QgUGFpciByID0gZihhLCBuLCBwKTsKICBmb3IoaT0wOyBpPG47IGkrKykgcHJpbnRmKCIlZCAiLCBhW2ldKTsKICBwcmludGYoIlxuJWQsJWRcbiIsIHIuZmlyc3QsIHIuc2Vjb25kKTsKfQo=