#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include  <map>
#include <set>
#include <utility>
#define pi 3.1415926535898
#define ll long long
#define lson rt<<1
#define rson rt<<1|1
#define eps 1e-6
#define ms(a,b) memset(a,b,sizeof(a))
#define legal(a,b) a&b
#define print1 printf("111\n")
using namespace std;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000007;
//998244353

int a[maxn];

int main()
{
    int _;
    scanf("%d",&_);
    for(int i=1;i<=_;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+1+_);
    printf("%d\n",(_==2)?0:_/2);
    int tem=1,tem2=_,n=(_-1)/2;
    while(1)
    {
        if(tem2<n)
            break;
        printf("%d ",a[tem2--]);
        if(tem!=n)
        {
            printf("%d ",a[tem++]);
        }

    }
    printf("\n");

}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include  <map>
#include <set>
#include <utility>
#define pi 3.1415926535898
#define ll long long
#define lson rt<<1
#define rson rt<<1|1
#define eps 1e-6
#define ms(a,b) memset(a,b,sizeof(a))
#define legal(a,b) a&b
#define print1 printf("111\n")
using namespace std;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000007;
//998244353

int a[maxn];

int main()
{
    int _;
    scanf("%d",&_);
    for(int i=1;i<=_;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+1+_);
    printf("%d\n",_/2);
    int tem=1,tem2=(_+1)/2,n=tem2;
    while(1)
    {
        printf("%d ",a[tem2++]);
        if(tem==n)
            break;
        printf("%d ",a[tem++]);

    }
    printf("\n");

}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include  <map>
#include <set>
#include <utility>
#define pi 3.1415926535898
#define ll long long
#define lson rt<<1
#define rson rt<<1|1
#define eps 1e-6
#define ms(a,b) memset(a,b,sizeof(a))
#define legal(a,b) a&b
#define print1 printf("111\n")
using namespace std;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000007;
//998244353

int a[maxn];

int main()
{
    int _;
    scanf("%d",&_);
    for(int i=1;i<=_;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+1+_);
    printf("%d\n",(_==2)?0:_/2);
    int tem=1,tem2=(_-1)/2,n=tem2;
    while(1)
    {
        if(tem2>_)
            break;
        printf("%d ",a[tem2++]);
        if(tem!=n)
        {
            printf("%d ",a[tem++]);
        }

    }
    printf("\n");

}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include  <map>
#include <set>
#include <utility>
#define pi 3.1415926535898
#define ll long long
#define lson rt<<1
#define rson rt<<1|1
#define eps 1e-6
#define ms(a,b) memset(a,b,sizeof(a))
#define legal(a,b) a&b
#define print1 printf("111\n")
using namespace std;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000007;
//998244353

int a[maxn];

int main()
{
    int _;
    scanf("%d",&_);
    for(int i=1;i<=_;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+1+_);
    printf("%d\n",(_==2)?0:_/2);
    int tem=1,tem2=(_+1)/2,n=tem2;
    while(1)
    {
        if(tem2>_)
            break;
        printf("%d ",a[tem2++]);
        if(tem!=n)
        {
            printf("%d ",a[tem++]);
        }

    }
    printf("\n");

}


#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include  <map>
#include <set>
#include <utility>
#define pi 3.1415926535898
#define ll long long
#define lson rt<<1
#define rson rt<<1|1
#define eps 1e-6
#define ms(a,b) memset(a,b,sizeof(a))
#define legal(a,b) a&b
#define print1 printf("111\n")
using namespace std;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1000000007;
//998244353

int a[maxn];

int main()
{
    int _;
    scanf("%d",&_);
    for(int i=1;i<=_;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+1+_);
    printf("%d\n",(_==2)?0:(_-1)/2);
    int tem=1,tem2=(_+1)/2,n=tem2;
    while(1)
    {
        if(tem2>_)
            break;
        printf("%d ",a[tem2++]);
        if(tem!=n)
        {
            printf("%d ",a[tem++]);
        }

    }
    printf("\n");

}


#include<bits/stdc++.h>
using namespace std;
#define dlwlrma ios::sync_with_stdio(0);cin.tie(0);
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define f first
#define s second
int main(){
    dlwlrma
}


#include<bits/stdc++.h>
using namespace std;
#define dlwlrma ios::sync_with_stdio(0); cin.tie(0);
#define ll long long

const int mxN = 1e5+2;
ll n,chu[mxN],ans[mxN];
int main(){
    dlwlrma
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> chu[i];
    sort(chu+1,chu+n+1);
    int idx = 1;
    for(int i= 2; i <= n; i+=2){
        ans[i]= chu[idx++];
    }
    for(int i = 1; i <= n; i+=2){
        ans[i] = chu[idx++];
    }
    int res = 0;
    for(int i = 2; i < n; i++){
        if(ans[i] < ans[i-1] && ans[i] < ans[i+1])
            res++;
    }
    cout << res << "\n";
    for(int i = 1; i <= n; i++)
        cout << ans[i] << " ";
}


#include<bits/stdc++.h>
using namespace std;
#define dlwlrma ios::sync_with_stdio(0); cin.tie(0);
#define ll long long

const int mxN = 1e5+2;
int n,chu[mxN];
int main(){
    dlwlrma
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> chu[i];
    sort(chu,chu+n);
    cout << (n-1)/2 << "\n";
    int idx = n-2;
    for(int i = 0; i < (n/3)-1; i++){
        cout << chu[idx] <<  " " << chu[idx-1] << " " << chu[idx+1] << " ";
        idx-=3;
    }
    if(n%3==1){
        cout << chu[2] << " " << chu[3] << " " << chu[0] << " " << chu[1];
    }
    if(n%3==2){
        cout << chu[2] << " " << chu[0] << " " << chu[3] << " " << chu[1] << " " << chu[4];
    }
}


    #include <bits/stdc++.h>
    #include <iostream>
    #include <vector>

    using namespace std;

    #define fo(i,n) for(int i=0; i<n; i++)
    #define Fo(i,k,n) for(int i=k; i<n; i++)
    #define ll long long
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define clr(x) memset(x, 0, sizeof(x))
    #define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
    #define PI 3.1415926535897932384626
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pii> vpii;
    typedef vector<pll> vpll;
    typedef vector<vi> vvi;
    typedef vector<vl> vvl;

    int main() {
        ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
        ll n;
        cin>>n;
        // int a[n];
        // for(int i=0;i<n;i++) cin>>a[i];
        // sort(a,a+n);
        ll f=n/2;
        if(n>2) cout<<f<<endl;
        else cout<<0<<endl;
        // for(int i=0;i<f;i++){
        //     int y=i*2;
        //     int h=a[y];
        //     a[y]=a[y+1];
        //     a[y+1]=h;
        // }
        // for(int i=0;i<n;i++) cout<<a[i]<<" ";
        return 0;
    }


#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

#define fo(i,n) for(int i=0; i<n; i++)
#define Fo(i,k,n) for(int i=k; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int f=n/2;
    cout<<f<<endl;
    // for(int i=0;i<f;i++){
    //     int y=i*2;
    //     int h=a[y];
    //     a[y]=a[y+1];
    //     a[y+1]=h;
    // }
    vector<int> l,u;
    int p=a[0]-1;
    bool put=0;
    for(int i=0;i<n;i++){
        if(put) l.push_back(a[i]);
        else u.push_back(a[i]);
        if(a[i]>p){
            p=a[i];
            put=!put;
        }
    }
    int unext=0;
    int lnext=0;
    put=0;
    // for(int i=0;i<u.size();i++) cout<<u[i];
    // cout<<endl;
    // for(int i=0;i<l.size();i++) cout<<l[i];
    // cout<<endl;
    int ji=n;
    while(ji>0){
        if(u.size()-1>=unext && put){
            cout<<u[unext]<<" ";
            unext++;
            ji--;
        }
        if(l.size()-1>=lnext && !put){
            cout<<l[lnext]<<" ";
            lnext++;
            ji--;
        }
        put=!put;
    }
    cout<<endl;
    // for(int i=0;i<f;i++){
    //     int y=i*2;
    //     int h=a[y];
    //     a[y]=a[y+1];
    //     a[y+1]=h;
    // }
    // for(int i=0;i<n;i++) cout<<a[i]<<" ";
    return 0;
}


#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

#define fo(i,n) for(int i=0; i<n; i++)
#define Fo(i,k,n) for(int i=k; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int f=n/2;
    cout<<f<<endl;
    for(int i=0;i<f;i++){
        int y=i*2;
        int h=a[y];
        a[y]=a[y+1];
        a[y+1]=h;
    }
    for(int i=0;i<n;i++) cout<<a[i]<<" ";
    return 0;
}


    #include <bits/stdc++.h>
    #include <iostream>
    #include <vector>

    using namespace std;

    #define fo(i,n) for(int i=0; i<n; i++)
    #define Fo(i,k,n) for(int i=k; i<n; i++)
    #define ll long long
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define clr(x) memset(x, 0, sizeof(x))
    #define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
    #define PI 3.1415926535897932384626
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pii> vpii;
    typedef vector<pll> vpll;
    typedef vector<vi> vvi;
    typedef vector<vl> vvl;

    int main() {
        ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
        int n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++) cin>>a[i];
        sort(a,a+n);
        int f=n/2;
        if(n>2) cout<<f<<endl;
        else cout<<0<<endl;
        for(int i=0;i<f;i++){
            int y=i*2;
            int h=a[y];
            a[y]=a[y+1];
            a[y+1]=h;
        }
        for(int i=0;i<n;i++) cout<<a[i]<<" ";
        return 0;
    }


    #include <bits/stdc++.h>
    #include <iostream>
    #include <vector>

    using namespace std;

    #define fo(i,n) for(int i=0; i<n; i++)
    #define Fo(i,k,n) for(int i=k; i<n; i++)
    #define ll long long
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define clr(x) memset(x, 0, sizeof(x))
    #define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
    #define PI 3.1415926535897932384626
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pii> vpii;
    typedef vector<pll> vpll;
    typedef vector<vi> vvi;
    typedef vector<vl> vvl;

    int main() {
        ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
        ll n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++) cin>>a[i];
        sort(a,a+n);
        ll f=n/2;
        if(n%2!=0) cout<<f<<endl;
        else cout<<f-1<<endl;
        for(int i=0;i<f;i++){
            int y=i*2;
            int h=a[y];
            a[y]=a[y+1];
            a[y+1]=h;
        }
        for(int i=0;i<n;i++) cout<<a[i]<<" ";
        return 0;
    }


#include <bits/stdc++.h>
#include <iostream>
#include <vector>

using namespace std;

#define fo(i,n) for(int i=0; i<n; i++)
#define Fo(i,k,n) for(int i=k; i<n; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define clr(x) memset(x, 0, sizeof(x))
#define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int f=n/2;
    cout<<f<<endl;
    // for(int i=0;i<f;i++){
    //     int y=i*2;
    //     int h=a[y];
    //     a[y]=a[y+1];
    //     a[y+1]=h;
    // }
    vector<int> l,u;
    int p=a[0]-1;
    bool put=0;
    for(int i=0;i<n;i++){
        if(put) l.push_back(a[i]);
        else u.push_back(a[i]);
        if(a[i]>p){
            p=a[i];
            put=!put;
        }
    }
    int unext=0;
    int lnext=0;
    put=0;
    // for(int i=0;i<u.size();i++) cout<<u[i];
    // cout<<endl;
    // for(int i=0;i<l.size();i++) cout<<l[i];
    // cout<<endl;
    int ji=n;
    while(ji>0){
        if(u.size()-1>=unext && put){
            cout<<u[unext]<<" ";
            unext++;
            ji--;
        }
        if(l.size()-1>=lnext && !put){
            cout<<l[lnext]<<" ";
            lnext++;
            ji--;
        }
        put=!put;
    }
    cout<<endl;
    // for(int i=0;i<f;i++){
    //     int y=i*2;
    //     int h=a[y];
    //     a[y]=a[y+1];
    //     a[y+1]=h;
    // }
    for(int i=0;i<n;i++) cout<<a[i]<<" ";
    return 0;
}


    #include <bits/stdc++.h>
    #include <iostream>
    #include <vector>

    using namespace std;

    #define fo(i,n) for(int i=0; i<n; i++)
    #define Fo(i,k,n) for(int i=k; i<n; i++)
    #define ll long long
    #define pb push_back
    #define mp make_pair
    #define F first
    #define S second
    #define clr(x) memset(x, 0, sizeof(x))
    #define tr(it, a) for(auto it=a.begin(); it!=a.end(); it++)
    #define PI 3.1415926535897932384626
    typedef pair<int, int> pii;
    typedef pair<ll, ll> pll;
    typedef vector<int> vi;
    typedef vector<ll> vl;
    typedef vector<pii> vpii;
    typedef vector<pll> vpll;
    typedef vector<vi> vvi;
    typedef vector<vl> vvl;

    int main() {
        ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
        ll n;
        cin>>n;
        int a[n];
        for(int i=0;i<n;i++) cin>>a[i];
        sort(a,a+n);
        ll f=n/2;
        if(n>2) cout<<f<<endl;
        else cout<<0<<endl;
        for(int i=0;i<f;i++){
            int y=i*2;
            int h=a[y];
            a[y]=a[y+1];
            a[y+1]=h;
        }
        for(int i=0;i<n;i++) cout<<a[i]<<" ";
        return 0;
    }


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
long long int mem[5001] = {INT_MIN};

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    int n;
    cin >> n;
    vector<ll int> prices(n, 0);
    for (int i = 0; i < n; i++)
        cin >> prices[i];
    if (n < 3)
    {
        cout << 0 << "\n";
        for (int i = 0; i < n; i++)
            cout << prices[i] << " ";
    }

    vector<ll int> ans;
    sort(prices.begin(), prices.end());

    for (int i = 0; i < n / 2; i++)
    {
        ans.push_back(prices[n - 1 - i]);
        ans.push_back(prices[i]);
    }
    if (n % 2)
        ans.push_back(prices[n / 2]);

    cout << n / 2 << "\n";
    for (int i = 0; i < n; i++)
        cout << ans[i] << " ";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
long long int mem[5001] = {INT_MIN};

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    int n;
    cin >> n;
    vector<ll int> prices(n, 0);
    for (int i = 0; i < n; i++)
        cin >> prices[i];
    if (n < 3)
    {
        cout << 0 << "\n";
        for (int i = 0; i < n; i++)
            cout << prices[i] << " ";
        return 0;
    }

    vector<ll int> ans;
    sort(prices.begin(), prices.end());

    for (int i = 0; i < n / 2; i++)
    {
        ans.push_back(prices[n - 1 - i]);
        ans.push_back(prices[i]);
    }
    if (n % 2)
        ans.push_back(prices[n / 2]);

    cout << ceil((double)n / 2) - 1 << "\n";
    for (int i = 0; i < n; i++)
        cout << ans[i] << " ";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
long long int mem[5001] = {INT_MIN};

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    int n;
    cin >> n;
    vector<ll int> prices(n, 0);
    vector<ll int> ans;
    for (int i = 0; i < n; i++)
        cin >> prices[i];

    sort(prices.begin(), prices.end());

    for (int i = 0; i < n / 2; i++)
    {
        ans.push_back(prices[n - 1 - i]);
        ans.push_back(prices[i]);
    }
    if (n % 2)
        ans.push_back(prices[n / 2]);

    cout << n / 2 << "\n";
    for (int i = 0; i < n; i++)
        cout << ans[i] << " ";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
long long int mem[5001] = {INT_MIN};

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    int n;
    cin >> n;
    vector<ll int> prices(n, 0);
    for (int i = 0; i < n; i++)
        cin >> prices[i];
    if (n < 3)
    {
        cout << 0 << "\n";
        for (int i = 0; i < n; i++)
            cout << prices[i] << " ";
        return 0;
    }

    vector<ll int> ans;
    sort(prices.begin(), prices.end());

    for (int i = 0; i < n / 2; i++)
    {
        ans.push_back(prices[n - 1 - i]);
        ans.push_back(prices[i]);
    }
    if (n % 2)
        ans.push_back(prices[n / 2]);

    cout << ceil(n / 2) - 1 << "\n";
    for (int i = 0; i < n; i++)
        cout << ans[i] << " ";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
long long int mem[5001] = {INT_MIN};

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    int n;
    cin >> n;
    vector<ll int> prices(n, 0);
    for (int i = 0; i < n; i++)
        cin >> prices[i];
    if (n < 3)
    {
        cout << 0 << "\n";
        for (int i = 0; i < n; i++)
            cout << prices[i] << " ";
        return 0;
    }

    vector<ll int> ans;
    sort(prices.begin(), prices.end());

    for (int i = 0; i < n / 2; i++)
    {
        ans.push_back(prices[n - 1 - i]);
        ans.push_back(prices[i]);
    }
    if (n % 2)
        ans.push_back(prices[n / 2]);

    cout << n / 2 << "\n";
    for (int i = 0; i < n; i++)
        cout << ans[i] << " ";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
long long int mem[5001] = {INT_MIN};

int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    ll int n, i, j;
    cin >> n;
    vector<ll int> prices(n);
    for (i = 0; i < n; i++)
        cin >> prices[i];
    if (n < 3)
    {
        cout << 0 << "\n";
        for (int i = 0; i < n; i++)
            cout << prices[i] << " ";
        return 0;
    }

    vector<ll int> ans;
    sort(prices.begin(), prices.end());

    // for (i = n - 1, j = n / 2 - 1; i >= n / 2; i--, j--)
    // {
    //     ans.push_back(prices[i]);
    //     ans.push_back(prices[j]);
    // }

    for (int i = 0; i < n / 2; i++)
    {
        ans.push_back(prices[n - 1 - i]);
        ans.push_back(prices[n / 2 - 1 - i]);
    }

    if (n % 2)
        ans.push_back(prices[n / 2]);

    int ct = 0;
    i = 1;
    while (i + 1 < n)
    {
        if (ans[i] < ans[i + 1] && ans[i] < ans[i - 1])
        {
            ct++;
        }
        i += 2;
    }
    if (!ct)
        ct = 1;
    cout << ct << "\n";
    for (i = 0; i < n; i++)
        cout << ans[i] << " ";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
// #define ll long long
#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}
signed main()
{
	fastio();
	int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n);
    for(int i=0;i<n;i++)
    	cout<<a[i]<<" ";
    return 0;
    int k=n-1;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";
    cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}
signed main()
{
	fastio();
//	cout<<endl;
    // test()
    // {

    // }
    int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n,greater<int>());
    int k=0;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k++;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k++;
    cout<<(n/2)<<endl;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
// #define ll long long
#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}
signed main()
{
	fastio();
//	cout<<endl;
    // test()
    // {

    // }
    int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n,greater<int>());
    int k=0;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k++;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k++;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
// #define ll long long
#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}
signed main()
{
	fastio();
    // test()
    // {

    // }
    int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n);
    int k=n-1;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}
signed main()
{
	fastio();
//	cout<<endl;
    // test()
    // {

    // }
    int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n,greater<int>());
    int k=0;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k++;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k++;
    cout<<((n-1)/2)<<endl;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
#define ll long long
#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}
signed main()
{
	fastio();
//	cout<<endl;
    // test()
    // {

    // }
    int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n,greater<int>());
    int k=0;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k++;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k++;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
 #define ll long long
//#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}
int main()
{
	fastio();
    // test()
    // {

    // }
    int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n);
    int k=n-1;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";cout<<endl;
}


#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define LONGMAX 1e18
// #define ll long long
#define int long long
#define MOD 1000000007       // #define MOD 998244353
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//#define dd double
//#define nl cout<<endl
//#define rt ll Q[100005]={0}
//#define mp make_pair
//#define s(ar,n) sort(ar,ar+n)
//#define rs(ar,n) sort(ar, ar+n, greater<ll>())
//#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
//#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
//#define maxa(ar,N) *max_element(ar,ar+N)
//#define mina(ar,N) *min_element(ar,ar+N)
//#define INF 1e9
//#define setbitll(a) __builtin_popcount(a)
//#define setbitll(a) __builtin_popcountll(a)
//#define lb lower_bound
//#define ub upper_bound
//#define bs binary_search
//ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
//ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
//ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
//vocheck ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mcheck=(low+high)/2;if(low>high)return;if(ar[mcheck]>=x){y=mcheck;ceilsearch(ar,low,mcheck-1,x,y);}else{ceilsearch(ar,mcheck+1,high,x,y);}}

signed main()
{
	fastio();
	int n;
    cin>>n;
    int a[n];
    cn(a,n);
    sort(a,a+n);
    for(int i=0;i<n;i++)
    	cout<<a[i]<<" ";
    for(int i=0;i<n;i++)
    	cout<<a[i]<<" ";
    for(int i=0;i<n;i++)
    	cout<<a[i]<<" ";
    return 0;
    int k=n-1;
    int b[n];
    for(int i=0;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=1;i<n;i+=2)
    	b[i]=a[k],k--;
    for(int i=0;i<n;i++)
    	cout<<b[i]<<" ";
    cout<<endl;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    int c;
    for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   sort(a.begin(),a.end());
   if(n<3)
   {
       cout<<"0"<<endl;
       for(int i=0;i<n;i++)
         cout<<a[i]<<" ";

   }
   else{
     if(n%2==1)
     c=n/2;
     else
       c=(n/2)-1;
       cout<<c<<endl;
       int r=0;
       for(int i=0;i<n;i++)
         {
             if(i%2==0)
             cout<<a[c++]<<" ";
             else
             cout<<a[r++]<<" ";
         }
   }
 return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    int c;
    for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   sort(a.begin(),a.end());
   if(n<3)
   {
       cout<<"0"<<endl;
       for(int i=0;i<n;i++)
         cout<<a[i];

   }
   else{
     if(n%2==1)
     c=n/2;
     else
       c=(n/2)-1;
       cout<<c<<endl;
       int r=0;
       for(int i=0;i<n;i++)
         {
             if(i%2==0)
             cout<<a[c++]<<" ";
             else
             cout<<a[r++]<<" ";
         }
   }
 return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    int c;
    for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   sort(a.begin(),a.end());
   if(n<3)
   {
       cout<<n<<endl;
       for(int i=0;i<n;i++)
         cout<<a[i];

   }
   else{
     if(n%2==1)
     c=n/2;
     else
       c=(n/2)-1;
       cout<<c<<endl;
       int r=0;
       for(int i=0;i<n;i++)
         {
             if(i%2==0)
             cout<<a[c++]<<" ";
             else
             cout<<a[r++]<<" ";
         }
   }
 return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int a[n];
    int c;
    for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   if(n%2==1)
     c=n/2;
     else
       c=(n/2)-1;
       cout<<c<<endl;
       int r=0;
       for(int i=0;i<n;i++)
         {
             if(i%2==0)
             cout<<a[c++]<<" ";
             else
             cout<<a[r++]<<" ";
         }

 return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    int c;
    for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   sort(a.begin(),a.end());

     if(n%2==1)
     c=n/2;
     else
       c=(n/2)-1;
       cout<<c<<endl;
       int r=0;
       for(int i=0;i<n;i++)
         {
             if(i%2==0)
             cout<<a[c++]<<" ";
             else
             cout<<a[r++]<<" ";
         }

 return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int>a(n);
    int c;
    for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   sort(a.begin(),a.end());
   if(n<3)
   {
       cout<<"0"<<endl;
       for(int i=0;i<n;i++)
         cout<<a[i]<<" ";

   }
   else{
       c=n/2;
     if(n%2==1)
        cout<<c<<endl;
     else
       cout<<c-1<<endl;
       int r=0;
       for(int i=0;i<n;i++)
         {
             if(i%2==0){
             cout<<a[c++]<<" ";
             }
             else
             cout<<a[r++]<<" ";
         }
   }
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define le long double
class dop
{public:
li n,p,q,r,e,f;
vector<li> a,b;
void get();
};
li power(li x,li n)
{li res=1;
while(n>0){if(n&1){res=res*x;}
x=x*x;n=n>>1;}
return res;}
void dop::get()
{cin>>n;
for(li i=0;i<n;i++){cin>>p;a.push_back(p);b.push_back(0);}
sort(a.begin(),a.end());
if(n==1||n==2){cout<<0<<'\n';
for(li i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';return ;}
q=0;e=0;f=n-1;
for(li i=1;i<n;i+=2){b[i]=a[e];e++;}
f=e;
cout<<(n/2)<<'\n';
for(li i=0;i<n;i+=2){b[i]=a[f];f++;}
for(li i=0;i<n;i++){cout<<b[i]<<" ";}cout<<'\n';

}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
li t=1;
dop obj[t];
for(li i=0;i<t;i++){obj[i].get();}
return 0;}


#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define le long double
class dop
{public:
li n,p,q,r,e,f;
vector<li> a,b;
void get();
};
li power(li x,li n)
{li res=1;
while(n>0){if(n&1){res=res*x;}
x=x*x;n=n>>1;}
return res;}
void dop::get()
{cin>>n;
for(li i=0;i<n;i++){cin>>p;a.push_back(p);b.push_back(0);}
sort(a.begin(),a.end());
//if(n==1){cout<<1<<'\n';cout<<a[0]<<'\n';return ;}
if(n==1||n==2){cout<<0<<'\n';
for(li i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';return ;}

q=0;e=0;f=n-1;
for(li i=1;i<n;i+=2){b[i]=a[e];e++;}
f=e;
if(n%2!=0){cout<<(n/2)<<'\n';}
else{cout<<(n-1)/2<<'\n';}
for(li i=0;i<n;i+=2){b[i]=a[f];f++;}
for(li i=0;i<n;i++){cout<<b[i]<<" ";}cout<<'\n';

}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
li t=1;
dop obj[t];
for(li i=0;i<t;i++){obj[i].get();}
return 0;}


#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define le long double
class dop
{public:
li n,p,q,r,e,f;
vector<li> a,b;
void get();
};
li power(li x,li n)
{li res=1;
while(n>0){if(n&1){res=res*x;}
x=x*x;n=n>>1;}
return res;}
void dop::get()
{cin>>n;
for(li i=0;i<n;i++){cin>>p;a.push_back(p);b.push_back(0);}
sort(a.begin(),a.end());
if(n==1||n==2){cout<<0<<'\n';
for(li i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';return ;}
q=0;e=0;f=n-1;
for(li i=1;i<n;i+=2){b[i]=a[e];e++;}
f=e;
for(li i=0;i<n;i+=2){b[i]=a[f];f++;}
for(li i=0;i<n;i++){cout<<b[i]<<" ";}cout<<'\n';

}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
li t=1;
dop obj[t];
for(li i=0;i<t;i++){obj[i].get();}
return 0;}


#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define le long double
class dop
{public:
li n,p,q,r,e,f;
vector<li> a,b;
void get();
};
li power(li x,li n)
{li res=1;
while(n>0){if(n&1){res=res*x;}
x=x*x;n=n>>1;}
return res;}
void dop::get()
{cin>>n;
for(li i=0;i<n;i++){cin>>p;a.push_back(p);b.push_back(0);}
sort(a.begin(),a.end());
q=0;e=0;f=n-1;
for(li i=1;i<n;i+=2){b[i]=a[e];e++;}
f=e;
for(li i=0;i<n;i+=2){b[i]=a[f];f++;}
cout<<(n/2)<<'\n';
for(li i=0;i<n;i++){cout<<b[i]<<" ";}cout<<'\n';

}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
li t=1;
dop obj[t];
for(li i=0;i<t;i++){obj[i].get();}
return 0;}


#include <bits/stdc++.h>
using namespace std;
#define li long long int
#define le long double
class dop
{public:
li n,p,q,r,e,f;
vector<li> a,b;
void get();
};
li power(li x,li n)
{li res=1;
while(n>0){if(n&1){res=res*x;}
x=x*x;n=n>>1;}
return res;}
void dop::get()
{cin>>n;
for(li i=0;i<n;i++){cin>>p;a.push_back(p);b.push_back(0);}
sort(a.begin(),a.end());
if(n==1){cout<<1<<'\n';cout<<a[0]<<'\n';return ;}
if(n==1||n==2){cout<<0<<'\n';
for(li i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';return ;}
q=0;e=0;f=n-1;
for(li i=1;i<n;i+=2){b[i]=a[e];e++;}
f=e;
cout<<(n/2)<<'\n';
for(li i=0;i<n;i+=2){b[i]=a[f];f++;}
for(li i=0;i<n;i++){cout<<b[i]<<" ";}cout<<'\n';

}
int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
li t=1;
dop obj[t];
for(li i=0;i<t;i++){obj[i].get();}
return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n;
cin>>n;
int a[n];
for(int &i:a)
    cin>>i;
sort(a,a+n);
cout<<n/2<<endl;
vector<int>b;
j=n/2;
for(i=0;i<n/2;i++)
    b.push_back(a[j++]),b.push_back(a[i]);
b.push_back(a[n-1]);
for(int &i:b)
    cout<<i<<" ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n;
cin>>n;
int a[n];
for(int &i:a)
    cin>>i;
    if(n<=2){
    cout<<0<<endl;
    for(int i:a)
     {
        cout<<i<<" ";
     }}
else{
        sort(a,a+n);
    cout<<n/2<<endl;
vector<int>b;
j=n/2;
for(i=0;i<n/2;i++)
    b.push_back(a[j++]),b.push_back(a[i]);
b.push_back(a[n-1]);
for(int &i:b)
    cout<<i<<" ";}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n;
cin>>n;
int a[n];
for(int &i:a)
    cin>>i;
sort(a,a+n);
cout<<n/2<<endl;
vector<int>b;
j=n/2+1;
for(i=0;i<n/2;i++)
    b.push_back(a[j++]),b.push_back(a[i]);
b.push_back(a[n/2]);
for(int &i:b)
    cout<<i<<" ";
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n;
cin>>n;
int a[n];
set<int>s1;
for(int &i:a)
    cin>>i,s1.insert(i);
    if(n<=2){
    cout<<0<<endl;
    for(int i:a)
     {
        cout<<i<<" ";
     }}
else{
        sort(a,a+n);
    cout<<s1.size()/2<<endl;
vector<int>b;
j=n/2;
for(i=0;i<n/2;i++)
    b.push_back(a[j++]),b.push_back(a[i]);
b.push_back(a[n-1]);
for(int &i:b)
    cout<<i<<" ";}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n;
cin>>n;
int a[n];
set<int>s1;
for(int &i:a)
    cin>>i,s1.insert(i);
    if(n<=2){
    cout<<0<<endl;
    for(int i:a)
     {
        cout<<i<<" ";
     }}
else{
        sort(a,a+n);
    cout<<(s1.size()-1)/2<<endl;
vector<int>b;
j=n/2;
for(i=0;i<n/2;i++)
    b.push_back(a[j++]),b.push_back(a[i]);
b.push_back(a[n-1]);
for(int &i:b)
    cout<<i<<" ";}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
int i,j,n;
cin>>n;
int a[n];
set<int>s1;
for(int &i:a)
    cin>>i,s1.insert(i);
    if(n<=2){
    cout<<0<<endl;
    for(int i:a)
     {
        cout<<i<<" ";
     }}
else{
        sort(a,a+n);
    cout<<(n-1)/2<<endl;
vector<int>b;
j=n/2;
for(i=0;i<n/2;i++)
    b.push_back(a[j++]),b.push_back(a[i]);
b.push_back(a[n-1]);
for(i=0;i<n;i++)
    cout<<b[i]<<" ";}
}


// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
#define inf 99999999999999999
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long>
#define LL (ll)
void outmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
    {
        f2(0,y-1)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
}
void inmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
        f2(0,y-1)
            cin>>mat[i][j];
}
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    f1(2,1e6+10)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
    ll n;
    cin>>n;
    vll v(n+1);
    f1(1,n) cin>>v[i];

        if(n<=2)
        {
            cout<<1<<endl;
         f1(1,n) cout<<v[i]<<" ";
         cout<<endl;
         }
         else
         {
             f1(1,n-1)
             {
                 swap(v[i],v[i+1]);
                 i++;
             }
             cout<<((n-3)/2)+1<<endl;
             f1(1,n) cout<<v[i]<<" ";
             cout<<endl;
         }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t; cin>>t; while(t--)
    solve();
}


// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
#define inf 99999999999999999
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long>
#define LL (ll)
void outmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
    {
        f2(0,y-1)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
}
void inmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
        f2(0,y-1)
            cin>>mat[i][j];
}
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    f1(2,1e6+10)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
    ll n;
    cin>>n;
    vll v(n+1);
    f1(1,n) cin>>v[i];

             f1(1,n-1)
             {
                 swap(v[i],v[i+1]);
                 i++;
             }
             ll res=(n-1)/2;
             if(n%3==1) res++;

             cout<<res<<endl;
             f1(1,n) cout<<v[i]<<" ";
             cout<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t; cin>>t; while(t--)
    solve();
}


// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
#define inf 99999999999999999
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long>
#define LL (ll)
void outmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
    {
        f2(0,y-1)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
}
void inmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
        f2(0,y-1)
            cin>>mat[i][j];
}
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    f1(2,1e6+10)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
    ll n;
    cin>>n;
    vll v(n+1);
    f1(1,n) cin>>v[i];

             f1(1,n-1)
             {
                 swap(v[i],v[i+1]);
                 i++;
             }
             ll res=(n-1)/2;
             if(n%3==1) res++;
            if(n<=2)cout<<1<<endl;
            else
             cout<<res<<endl;
             f1(1,n) cout<<v[i]<<" ";
             cout<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t; cin>>t; while(t--)
    solve();
}


// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
#define inf 99999999999999999
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long>
#define LL (ll)
void outmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
    {
        f2(0,y-1)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
}
void inmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
        f2(0,y-1)
            cin>>mat[i][j];
}
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    f1(2,1e6+10)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
    ll n;
    cin>>n;
    vll v(n);
    f1(0,n-1) cin>>v[i];

    sort(all(v));
             f1(0,n-2)
             {
                 swap(v[i],v[i+1]);
                 i++;
             }
             ll res=(n-1)/2;

             cout<<res<<endl;
             f1(0,n-1) cout<<v[i]<<" ";
             cout<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //int t; cin>>t; while(t--)
    solve();
}


// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
#define inf 99999999999999999
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long>
#define LL (ll)
void outmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
    {
        f2(0,y-1)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
}
void inmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
        f2(0,y-1)
            cin>>mat[i][j];
}
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    f1(2,1e6+10)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
    ll n;
    cin>>n;
    vll v(n);
    f1(0,n-1) cin>>v[i];

    sort(all(v));
             f1(0,n-2)
             {
                 swap(v[i],v[i+1]);
                 i++;
             }
             ll res=(n-1)/2;
             if(n%3==1) res++;
            if(n<=2)cout<<1<<endl;
            else
             cout<<res<<endl;
             f1(0,n-1) cout<<v[i]<<" ";
             cout<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t; cin>>t; while(t--)
    solve();
}


// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
#define inf 99999999999999999
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long>
#define LL (ll)
void outmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
    {
        f2(0,y-1)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
}
void inmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
        f2(0,y-1)
            cin>>mat[i][j];
}
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    f1(2,1e6+10)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
    ll n;
    cin>>n;
    vll v(n+1);
    f1(1,n) cin>>v[i];

    sort(all(v));
             f1(1,n-1)
             {
                 swap(v[i],v[i+1]);
                 i++;
             }
             ll res=(n-1)/2;
             if(n%3==1) res++;
            if(n<=2)cout<<1<<endl;
            else
             cout<<res<<endl;
             f1(1,n) cout<<v[i]<<" ";
             cout<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t; cin>>t; while(t--)
    solve();
}


// Sumonto Chatterjee
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Mod 1000000007
#define inf 99999999999999999
#define f1(a,b) for(ll i=a;i<=b;i++)
#define f2(a,b) for(ll j=a;j<=b;j++)
#define f3(a,b) for(ll k=a;k<=b;k++)
#define fr(a,b) for(ll r=a;r>=b;r--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define vll vector<long long>
#define LL (ll)
void outmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
    {
        f2(0,y-1)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
}
void inmat(auto mat, ll x, ll y)
{
    f1(0,x-1)
        f2(0,y-1)
            cin>>mat[i][j];
}
ll mult_inv(ll a1, ll m2)
{
    ll m1=m2,y1=0,x1=1;
    if(m2==1)
        return 0;
    while(a1>1)
    {
        ll q1=a1/m2,t1=m2;
        m2=a1%m2,a1=t1;
        t1=y1;
        y1=x1-q1*y1;
        x1=t1;
    }
    if(x1<0)
        x1+=m1;
    return x1;
}
vll sieve(1e6+10,0);
void make_sieve()
{
    f1(2,1e6+10)
        if(!sieve[i])
            for( ll u=2*i; u<=1e6+10;u+=i)
                sieve[u]=i;
}
ll modpow(ll x,ll n,ll m)
{
    if(!n) return 1%m;
    ll u=modpow(x,n/2,m);
    u=(u*u)%m;
    if(n&1) u=(u*x)%m;
    return u;
}
void solve()
{
    ll n;
    cin>>n;
    vll v(n);
    f1(0,n-1) cin>>v[i];

    sort(all(v));
             f1(0,n-2)
             {
                 swap(v[i],v[i+1]);
                 i++;
             }
             ll res=(n-1)/2;
             if(n%3==1) res++;
            if(n<=2)cout<<1<<endl;
            else
             cout<<res<<endl;
             f1(0,n-1) cout<<v[i]<<" ";
             cout<<endl;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //int t; cin>>t; while(t--)
    solve();
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

ll arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while(t--){
		ll n;
		cin >> n;

		for(int i = 0; i < n; i++){
			cin >> arr[i];
		}

		int l = 0, r = n;
		bool ok = 0;
		while(l <= r && !ok){

			int m = (l + r) / 2;
			std::deque<int> Qi, Qim;

			//for(int i = 0; i < m; i++) Qi.push_back(i), Qim.push_back(i);
			int i;
			for (i = 0; i < m; ++i) {
				while ((!Qi.empty()) && arr[i] >= arr[Qi.back()])
					Qi.pop_back();
				Qi.push_back(i);

				while ((!Qim.empty()) && arr[i] <= arr[Qim.front()])
					Qim.pop_front();
				Qim.push_back(i);
			}

			for (; i < n && !ok; ++i) {

				/*
				if(arr[Qi.front()] - arr[Qim.back()] >= m){
					cout << "YES\n";
					cout << arr[Qi.front()]  << " "  << arr[Qim.back()] << endl;
					cout << min(Qi.front() + 1, Qim.back() + 1) << " " << max(Qi.front() + 1, Qim.back() + 1) << endl;
					ok = 1;
				}
				*/
				if(abs(arr[Qi.front()] - arr[Qim.back()]) >= m && !ok){
					cout << "YES\n";
					cout << min(Qi.front() + 1, Qim.back() + 1) << " " << max(Qi.front() + 1, Qim.back() + 1) << endl;
					ok = 1;
				}
				while ((!Qi.empty()) && Qi.front() <= i - m)
					Qi.pop_front();
				while ((!Qi.empty()) && arr[i] >= arr[Qi.back()])
					Qi.pop_back();

				Qi.push_back(i);

				while ((!Qim.empty()) && Qim.back() <= i - m)
					Qim.pop_back();
				while ((!Qim.empty()) && arr[i] <= arr[Qim.front()])
					Qim.pop_front();

				Qim.push_front(i);
			}
			if(abs(arr[Qi.front()] - arr[Qim.back()]) >= m && !ok){
				cout << "YES\n";
				cout << min(Qi.front() + 1, Qim.back() + 1) << " " << max(Qi.front() + 1, Qim.back() + 1) << endl;
				ok = 1;
			}

			if(ok){
				break;
			}
			else l = m + 1;
		}
		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = (l + r) / 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= abs(-(*y).second - (*x).second) + 1){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				l = m + 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = (l + r) / 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}
			auto x = farah.begin();
			auto y = farahfuck.begin();

			if(-(*y).first - (*x).first >= m){
				cout << "YES\n";
				cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
				ok = 1;
			}
			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(-(*y).first - (*x).first >= m){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}
				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				l = m + 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = (l + r) / 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= abs((*y).second - (*x).second) + 1 && abs((*y).second - (*x).second) + 1 > 1){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				r = m - 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

ll arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while(t--){
		ll n;
		cin >> n;

		for(int i = 0; i < n; i++){
			cin >> arr[i];
		}

		int l = 0, r = n;
		bool ok = 0;
		while(l <= r && !ok){

			int m = (l + r) / 2;
			std::deque<int> Qi, Qim;

			//for(int i = 0; i < m; i++) Qi.push_back(i), Qim.push_back(i);
			int i;
			for (i = 0; i < m; ++i) {
				while ((!Qi.empty()) && arr[i] >= arr[Qi.back()])
					Qi.pop_back();
				Qi.push_back(i);

				while ((!Qim.empty()) && arr[i] <= arr[Qim.front()])
					Qim.pop_front();
				Qim.push_back(i);
			}

			for (; i < n && !ok; ++i) {

				/*
				if(arr[Qi.front()] - arr[Qim.back()] >= m){
					cout << "YES\n";
					cout << arr[Qi.front()]  << " "  << arr[Qim.back()] << endl;
					cout << min(Qi.front() + 1, Qim.back() + 1) << " " << max(Qi.front() + 1, Qim.back() + 1) << endl;
					ok = 1;
				}
				*/
				if(abs(arr[Qi.front()] - arr[Qim.front()]) >= m && !ok){
					cout << "YES\n";
					cout << min(Qi.front() + 1, Qim.front() + 1) << " " << max(Qi.front() + 1, Qim.front() + 1) << endl;
					ok = 1;
				}
				while ((!Qi.empty()) && Qi.front() <= i - m)
					Qi.pop_front();
				while ((!Qi.empty()) && arr[i] >= arr[Qi.back()])
					Qi.pop_back();

				Qi.push_back(i);

				while ((!Qim.empty()) && Qim.back() <= i - m)
					Qim.pop_back();
				while ((!Qim.empty()) && arr[i] <= arr[Qim.front()])
					Qim.pop_front();

				Qim.push_front(i);
			}
			if(abs(arr[Qi.front()] - arr[Qim.front()]) >= m && !ok){
				cout << "YES\n";
				cout << min(Qi.front() + 1, Qim.front() + 1) << " " << max(Qi.front() + 1, Qim.front() + 1) << endl;
				ok = 1;
			}

			if(ok){
				break;
			}
			else l = m + 1;
		}
		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= abs((*y).second - (*x).second) + 1 && abs((*y).second - (*x).second) + 1 > 1){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				r = m - 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= 2){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				break;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = (l + r) / 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= abs((*y).second - (*x).second) + 1 && abs((*y).second - (*x).second) + 1 > 1){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				l = m + 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = (l + r) / 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= abs(-(*y).second - (*x).second) + 1 && abs(-(*y).second - (*x).second) + 1 > 1){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				l = m + 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

int arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 1, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = (l + r) / 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1 && !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= m){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1 <<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}

				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
			}

			if(!ok){
				l = m + 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
   TASK: mountains
   LANG: C++14
 */

#include "bits/stdc++.h"

//region Template

typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
using namespace std;
#define finish(x) cout << x; exit(0);
#define fastIO cin.tie(0); cin.sync_with_stdio(false);

void setIn(string s) { freopen(s.c_str(), "r", stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }

//const string USCAO_TAG = "mountains";
void usaco(string USACO_TAG) { setIn(USACO_TAG + ".in"); setOut(USACO_TAG + ".out"); }

template<typename... Args>
void print(Args... args) {
	#ifdef LOCAL
	((std::cout << args << " "), ...);
	cout << endl;
	#endif
}
//endregion

/* Notes:
 * Farah.. farah :((
 */

using namespace std;

const int MAXN = 2 * 100005;

ll arr[MAXN];

int main() {
	//usaco("lifeguards");
	#ifdef LOCAL
	setIn("in.txt");
	setOut("out.txt");
	#endif

	int t;
	cin >> t;

	while (t--) {
		ll n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> arr[i];
		}

		int l = 0, r = n;
		bool ok = 0;
		while (l <= r && !ok) {

			int m = (l + r) / 2;
			set<pair<int, int>> farah, farahfuck;
			for(int i = 0; i < m; i++){
				farah.insert({arr[i], i});
				farahfuck.insert({-arr[i], i});
			}

			for(int i = m; i < n + 1&& !ok; i++){
				auto x = farah.begin();
				auto y = farahfuck.begin();

				if(-(*y).first - (*x).first >= m){
					cout << "YES\n";
					cout << min((*x).second, (*y).second) + 1<<  " " << max((*x).second, (*y).second) + 1 << endl;
					ok = 1;
				}
				if(i < n) {
					farah.insert({arr[i], i});
					farahfuck.insert({-arr[i], i});
				}
				while(!farahfuck.empty() && (*farahfuck.begin()).second <= i - m)
					farahfuck.erase(farahfuck.begin());

				while(!farah.empty() && (*farah.begin()).second <= i - m)
					farah.erase(farah.begin());

			}

			if(!ok){
				l = m + 1;
			}
		}

		if(!ok){
			cout << "NO\n";
		}
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n;
		cin >> n;
		vector<ll>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		bool flag = 0;
		int i, j, k;
		for ( i = 0; i < n; i++){
			for ( j = i; j < n; j++){
				ll mx = -1, mn = 1e10;
				for ( k = i; k <= j; k++){
					mx = max(mx, v[k]);
					mn = min(mn, v[k]);
				}
				if ((mx - mn) >= n){
					flag = 1;
					break;
				}
			}
			if (flag)break;
		}
		if (flag)cout << "YES\n" << i+1 << " " << j+1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n;
		cin >> n;
		vector<ll>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		bool flag = 0;
		int i, j, k;
		for (i = 0; i < n; i++){
			for (j = i+1; j < n; j++){
				ll mx = -1, mn = 1e10, x = j - i + 1;
				for (k = i; k <= j; k++){
					mx = max(mx, v[k]);
					mn = min(mn, v[k]);
				}
				if ((mx - mn) >= x){
					flag = 1;
					break;
				}
			}
			if (flag)break;
		}
		if (flag)cout << "YES\n" << i + 1 << " " << j + 1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n, l=0, r=0;
		cin >> n;
		vector<pair<ll,ll>>v(n);
		for (int i = 0; i < n; i++)cin >> v[i].first, v[i].second=i;
		sort(all(v));
		bool flag = 0;
		for (int i = 1; i < n; i++){
			if ((v[i].first - v[i - 1].first) >= abs(v[i - 1].second - v[i].second)+1){
				l = v[i-1].second;
				r = v[i].second;
				flag = 1;
				break;
			}
		}
		if (l>r)swap(l, r);
		if (flag)cout << "YES\n" << l + 1 << " " << r + 1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n,ans;
		cin >> n;
		bool flag=0;
		vector<ll>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		for(int i=1;i<n;i++){
		    if(abs(v[i]-v[i-1])>1){
		        flag=1;
		        ans=i;
		        break;
		    }
		}
		if (flag)cout << "YES\n" << ans - 1 << " " << ans << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n;
		cin >> n;
		vector<ll>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		ll l = -1, r = -1, mx = -1, mn = OO;
		bool flag = 0;
		while (l <= r){
			while (r + 1 < n && ((mx - mn) < n)){
				r++;
				mx = max(mx, v[r]);
				mn = min(mn, v[r]);
			}
			if ((mx - mn) >= n){
				flag = 1;
				break;
			}
			l++;
			if (l>r)break;
			if (v[l] == mx){
				mx = -1;
				for (int i = l + 1; i <= r; i++)
					mx = max(mx, v[i]);
			}
			if (v[l] == mn){
				mn = OO;
				for (int i = l + 1; i <= r; i++)
					mn = min(mn, v[i]);
			}
		}
		if (l == -1)l = 0;
		if (flag)cout << "YES\n" << l + 1 << " " << r + 1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n;
		cin >> n;
		vector<ll>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		ll l = -1, r = 0, mx = -1, mn = OO;
		bool flag = 0;
		while (++l <= r){
			while (r < n && ((mx - mn) < n)){
				mx = max(mx, v[r]);
				mn = min(mn, v[r]);
				r++;
			}
			if (r == n)r--;
			if ((mx - mn) >= n){
				flag = 1;
				break;
			}
			if (v[l] == mx){
				mx = -1;
				for (int i = l + 1; i <= r; i++)
					mx = max(mx, v[i]);
			}
			if (v[l] == mn){
				mn = OO;
				for (int i = l + 1; i <= r; i++)
					mn = min(mn, v[i]);
			}
		}
		if (flag)cout << "YES\n" << l + 1 << " " << r + 1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n;
		cin >> n;
		vector<ll>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		bool flag = 0;
		int i, j, k;
		for (i = 0; i < n; i++){
			for (j = i+1; j < n; j++){
				ll mx = -1, mn = 1e10;
				for (k = i; k <= j; k++){
					mx = max(mx, v[k]);
					mn = min(mn, v[k]);
				}
				if ((mx - mn) >= n){
					flag = 1;
					break;
				}
			}
			if (flag)break;
		}
		if (flag)cout << "YES\n" << i + 1 << " " << j + 1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n;
		cin >> n;
		vector<ll>v(n+1);
		for (int i = 1; i <= n; i++)cin >> v[i];
		ll l = 0, r = 0, mx = -1, mn = OO;
		bool flag = 0;
		while (l <= r){
			while (r + 1 <= n && ((mx - mn) < ((r-l)+1) )){
				r++;
				mx = max(mx, v[r]);
				mn = min(mn, v[r]);
			}
			if (((mx - mn) >= ((r - l)))){
				flag = 1;
				break;
			}
			l++;
			if (l>r)break;
			if (v[l] == mx){
				mx = -1;
				for (int i = l + 1; i <= r; i++)
					mx = max(mx, v[i]);
			}
			if (v[l] == mn){
				mn = OO;
				for (int i = l + 1; i <= r; i++)
					mn = min(mn, v[i]);
			}
			if (((mx - mn) >= ((r - l) + 1))){
				flag = 1;
				break;
			}
		}
		if (l == -1)l = 0;
		if (r == n)r = n - 1;
		if (flag)cout << "YES\n" << l + 1 << " " << r + 1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n,ans;
		cin >> n;
		bool flag=0;
		vector<ll>v(n);
		for (int i = 0; i < n; i++)cin >> v[i];
		for(int i=1;i<n;i++){
		    if(abs(v[i]-v[i-1])>1){
		        flag=1;
		        ans=i;
		        break;
		    }
		}
		if (flag)cout << "YES\n" << ans << " " << ans - 1 << endl;
		else cout << "NO\n";
	}
}


/*
██╗  ██╗   ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝   ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝    █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗    ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define ss cout<<endl;system("pause");
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//r.erase(remove(all(r), '&'), r.end());
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
ll OO = (1LL * oo*oo);
void K_K()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main(){
	K_K();
	ll t;
	cin >> t;
	while (t--){
		ll n, l=0, r=0;
		cin >> n;
		vector<pair<ll,ll>>v(n);
		for (int i = 0; i < n; i++)cin >> v[i].first, v[i].second=i;
	//	sort(all(v));
		bool flag = 0;
		for (int i = 1; i < n; i++){
			if ((v[i].first - v[i - 1].first) >= abs(v[i - 1].second - v[i].second)+1){
				l = v[i-1].second;
				r = v[i].second;
				flag = 1;
				break;
			}
		}
		if (l>r)swap(l, r);
		if (flag)cout << "YES\n" << l + 1 << " " << r + 1 << endl;
		else cout << "NO\n";
	}
}