using namespace std;
#include<bits/stdc++.h>
typedef long long   LL;
typedef long long   ll;
typedef   pair<LL,LL>  PII;
typedef   vector< PII > VPII;
typedef   vector<long long>   VI;
typedef   map<string,LL>  MSI;
typedef   map<LL,LL>  MII;
///Print
#define R(n)       scanf("%lld", &n)
#define P(a)  printf("%lld\n",a)
#define NL printf("\n")
#define case(no) printf("Case %lld: ",++no)
#define casenl(no) printf("Case %lld:\n",++no)
///LOOP
#define rep(x,n) for(__typeof(n) x=0;x<(n);x++)
#define reps(i,x) for(int  i=0;i<(x.size());i++)
#define repp(x,n) for(__typeof(n) x=1;x<=(n);x++)
#define FORSTL(x,n) for(__typeof(n.begin()) x=n.begin();x!=n.end();x++)
///Shortcut
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())
#define len(s) s.size()
#define MP make_pair
#define PB push_back
#define FF first
#define SS second
///Min AND Max
#define MIN3(a,b,c) min(a,min(b,c))
#define MAX3(a,b,c) max(a,max(b,c))
#define EPS (1e-9)
#define PI acos(-1.0)
#define isEq(a,b) (fabs((a)-(b))<eps)
#define Fast ios_base::sync_with_stdio(false); cin.tie(false);
///DEBUG
#define D(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define DD(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<endl;
#define DDD(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" ="<<z<<endl;
///Gcd and Lcm
template<class T>T gcd(T a,T b){return b == 0 ? a : gcd(b, a % b);}
template<typename T>T lcm(T a, T b) {return a / gcd(a,b) * b;}
///Bigmod && Pow
template<class T>T my_pow(T n,T p){if(p==0)return 1;T x=my_pow(n,p/2);x=(x*x);if(p&1)x=(x*n);return x;} ///n to the power p
template<class T>T big_mod(T n,T p,T m){if(p==0)return (T)1;T x=big_mod(n,p/2,m);x=(x*x)%m;if(p&1)x=(x*n)%m;return x;}
///string to int
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}///
string itos(LL n){string s;while(n){s+=(n%10+48);n/=10;}reverse(all(s));return s;}
LL stoi(string s){LL n=0;rep(i,len(s))n=n*10+(s[i]-48);return n;}
//struct info{LL x,y;}arr[100005];bool com(info a,info b){return (a.x<b.x) or (a.x==b.x anda.y<b.y);}
LL ar[100001],br[100001];
LL a=0,b=0,c=0,r=0,rr=0,res=0,n,m,t=0,ks=0,w;
string  s;

int main()
{
    //Fast;

    cin>>n;

    if(n<=1)
    {
        cout<<"YES\n";

        return 0;
    }

    rep(i,n)cin>>ar[i];

    rep(i,n)
    {
        if(ar[i]==0)c++;
    }

    if(c==1 )printf("YES");
    else printf("NO");

   return 0;

}


using namespace std;
#include<bits/stdc++.h>
typedef long long   LL;
typedef long long   ll;
typedef   pair<LL,LL>  PII;
typedef   vector< PII > VPII;
typedef   vector<long long>   VI;
typedef   map<string,LL>  MSI;
typedef   map<LL,LL>  MII;
///Print
#define R(n)       scanf("%lld", &n)
#define P(a)  printf("%lld\n",a)
#define NL printf("\n")
#define case(no) printf("Case %lld: ",++no)
#define casenl(no) printf("Case %lld:\n",++no)
///LOOP
#define rep(x,n) for(__typeof(n) x=0;x<(n);x++)
#define reps(i,x) for(int  i=0;i<(x.size());i++)
#define repp(x,n) for(__typeof(n) x=1;x<=(n);x++)
#define FORSTL(x,n) for(__typeof(n.begin()) x=n.begin();x!=n.end();x++)
///Shortcut
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())
#define len(s) s.size()
#define MP make_pair
#define PB push_back
#define FF first
#define SS second
///Min AND Max
#define MIN3(a,b,c) min(a,min(b,c))
#define MAX3(a,b,c) max(a,max(b,c))
#define EPS (1e-9)
#define PI acos(-1.0)
#define isEq(a,b) (fabs((a)-(b))<eps)
#define Fast ios_base::sync_with_stdio(false); cin.tie(false);
///DEBUG
#define D(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define DD(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<endl;
#define DDD(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" ="<<z<<endl;
///Gcd and Lcm
template<class T>T gcd(T a,T b){return b == 0 ? a : gcd(b, a % b);}
template<typename T>T lcm(T a, T b) {return a / gcd(a,b) * b;}
///Bigmod && Pow
template<class T>T my_pow(T n,T p){if(p==0)return 1;T x=my_pow(n,p/2);x=(x*x);if(p&1)x=(x*n);return x;} ///n to the power p
template<class T>T big_mod(T n,T p,T m){if(p==0)return (T)1;T x=big_mod(n,p/2,m);x=(x*x)%m;if(p&1)x=(x*n)%m;return x;}
///string to int
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}///
string itos(LL n){string s;while(n){s+=(n%10+48);n/=10;}reverse(all(s));return s;}
LL stoi(string s){LL n=0;rep(i,len(s))n=n*10+(s[i]-48);return n;}
//struct info{LL x,y;}arr[100005];bool com(info a,info b){return (a.x<b.x) or (a.x==b.x anda.y<b.y);}
LL ar[100001],br[100001];
LL a=0,b=0,c=0,r=0,rr=0,res=0,n,m,t=0,ks=0,w;
string  s;

int main()
{
    //Fast;

    cin>>n;

    if(n<=1)
    {
        cout<<"YES\n";

        return 0;
    }

    rep(i,n)cin>>ar[i];

    if(ar[0]==1  and ar[n-1]==1)
    {
         cout<<"YES\n";

        return 0;
    }

    cout<<"NO\n";

   return 0;

}


using namespace std;
#include<bits/stdc++.h>
typedef long long   LL;
typedef long long   ll;
typedef   pair<LL,LL>  PII;
typedef   vector< PII > VPII;
typedef   vector<long long>   VI;
typedef   map<string,LL>  MSI;
typedef   map<LL,LL>  MII;
///Print
#define R(n)       scanf("%lld", &n)
#define P(a)  printf("%lld\n",a)
#define NL printf("\n")
#define case(no) printf("Case %lld: ",++no)
#define casenl(no) printf("Case %lld:\n",++no)
///LOOP
#define rep(x,n) for(__typeof(n) x=0;x<(n);x++)
#define reps(i,x) for(int  i=0;i<(x.size());i++)
#define repp(x,n) for(__typeof(n) x=1;x<=(n);x++)
#define FORSTL(x,n) for(__typeof(n.begin()) x=n.begin();x!=n.end();x++)
///Shortcut
#define mem(ar,value) memset(ar,value,sizeof(ar))
#define all(x) x.begin(),x.end()
#define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin())
#define len(s) s.size()
#define MP make_pair
#define PB push_back
#define FF first
#define SS second
///Min AND Max
#define MIN3(a,b,c) min(a,min(b,c))
#define MAX3(a,b,c) max(a,max(b,c))
#define EPS (1e-9)
#define PI acos(-1.0)
#define isEq(a,b) (fabs((a)-(b))<eps)
#define Fast ios_base::sync_with_stdio(false); cin.tie(false);
///DEBUG
#define D(x) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<endl;
#define DD(x,y) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<endl;
#define DDD(x,y,z) cerr<<__FUNCTION__<<":"<<__LINE__<<": "#x" = "<<x<<" | "#y" = "<<y<<" | "#z" ="<<z<<endl;
///Gcd and Lcm
template<class T>T gcd(T a,T b){return b == 0 ? a : gcd(b, a % b);}
template<typename T>T lcm(T a, T b) {return a / gcd(a,b) * b;}
///Bigmod && Pow
template<class T>T my_pow(T n,T p){if(p==0)return 1;T x=my_pow(n,p/2);x=(x*x);if(p&1)x=(x*n);return x;} ///n to the power p
template<class T>T big_mod(T n,T p,T m){if(p==0)return (T)1;T x=big_mod(n,p/2,m);x=(x*x)%m;if(p&1)x=(x*n)%m;return x;}
///string to int
template <class T> T extract(string s, T ret) {stringstream ss(s); ss >> ret; return ret;}///
string itos(LL n){string s;while(n){s+=(n%10+48);n/=10;}reverse(all(s));return s;}
LL stoi(string s){LL n=0;rep(i,len(s))n=n*10+(s[i]-48);return n;}
//struct info{LL x,y;}arr[100005];bool com(info a,info b){return (a.x<b.x) or (a.x==b.x anda.y<b.y);}
LL ar[100001],br[100001];
LL a=0,b=0,c=0,r=0,rr=0,res=0,n,m,t=0,ks=0,w;
string  s;

int main()
{
    //Fast;

    cin>>n;

    if(n<=1)
    {
        cout<<"YES\n";

        return 0;
    }

    rep(i,n)cin>>ar[i];

    rep(i,n)
    {
        if(ar[i]==0)c++;
    }

    if(c==1    and   ar[0]==1)printf("YES");
    else printf("NO");

   return 0;

}


#include <iostream>

using namespace std;

int main(void)
{
    int n, sum = 0, sum2 = 0;
    char t;

    cin >> n;

    n--;
    while(n--)
    {
        cin >> t;
        if(t == '0')
            sum++;
        else
            sum2++;
    }

    cin >> t;

    if(sum == 0 && t == '1')
        cout << "YES";
    else if(sum == 1 && t != '0')
        cout << "YES";
    else if(sum2 == 1 && t != '0')
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>

using namespace std;

int main(void)
{
    int n, sum = 0;
    char t;

    cin >> n >> t;

    while(--n)
    {
        cin >> t;
        if(t == '1')
           sum++;
    }

    if(sum == 1)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>

using namespace std;

int main(void)
{
    int n, sum = 0;
    char t;

    cin >> n;

    if(n == 1)
    {
        cin >> t;
        if(t == '1')
            cout << "YES";
        else
            cout << "NO";

        return 0;
    }

    while(n--)
    {
        cin >> t;
        if(t == '0')
           sum++;
    }

    if(sum == 1)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>

using namespace std;

int main(void)
{
    int n, sum = 0;
    char t;

    cin >> n;

    while(n--)
    {
        cin >> t;
        if(t == '0')
           sum++;
    }

    if(sum <= 1)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>

using namespace std;

int main(void)
{
    int n, sum = 0;
    char t;

    cin >> n;

    n--;
    while(n--)
    {
        cin >> t;
        if(t == '0')
           sum++;
    }

    cin >> t;

    if(sum == 0 && t == '1')
        cout << "YES";
    else if(sum == 1 && t != '0')
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>

using namespace std;

int main(void)
{
    int n, sum = 0;
    char t;

    cin >> n;

    n--;
    while(n--)
    {
        cin >> t;
        if(t == '0')
           sum++;
    }

    cin >> t;

    if(sum == 1 && t == '1')
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


#include <iostream>

using namespace std;

int main(void)
{
    int n, sum = 0;
    char t;

    cin >> n;

    while(n--)
    {
        cin >> t;
        if(t == '0')
           sum++;
    }

    if(sum == 1)
        cout << "YES";
    else
        cout << "NO";

    return 0;
}


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

int main(int argc, char const *argv[])
{
	int count = 0, n, temp, lastButton = 0;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		if( temp==1 )
			count++;
	}

	cout << ( count==n-1 ? "YES" : "NO" );

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int count = 0, n, temp, lastButton = 0;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		if( temp==1 )
			count++;
	}

	cout << ( (count==n-1 || count==n-2 || (count==1 && n==1)) ? "YES" : "NO" );

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int count = 0, n, temp, lastButton = 0;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		if( count )
			count++;
	}

	cout << ( ( (n==1 && count==1) || (n>1 && count==n-1)) ? "YES" : "NO" );

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int count = 0, n, temp, lastButton = 0;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		count++;
	}

	cout << ( ( (n==1 && count==1) || (n>1 && count==n-1)) ? "YES" : "NO" );

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int count = 0, n, temp, lastButton = 0;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		if( temp==1 )
			count++;
	}

	cout << ( (count==n-1 || (count==1 && n==1)) ? "YES" : "NO" );

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int count = 0, n, temp, lastButton = 0;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		if( temp )
			count++;
	}

	cout << ( ( (n==1 && count==1) || (n>1 && count==n-1)) ? "YES" : "NO" );

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int count, n, temp;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		if( temp )
			count++;
		if( count > 1) {
			cout << "NO";
			return 0;
		}
	}

	cout << ( count==1 ? "YES" : "NO" );

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int count = 0, n, temp, lastButton = 0;

	cin >> n;
	for (int i = 0; i < n; ++i)	{
		cin >> temp;
		if( temp==1 )
			count++;
	}

	cout << ( (count==n-1) ? "YES" : "NO" );

	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if((con==1)and(n==1))
    {
        cout<<"NO";
    }
    else if(con>1)//and(cov))
        {
            cout<<"NO";
        }
        else if(cov==n)
        {
            cout<<"NO";
        }
            else if((con=1)and(cov>1))
            {
                cout<<"YES";
            }

}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if(cov==(n-con))
    {//
        cout<<"YES";
    }
    else
    {
        cout<<"NO"
    }

}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if((con==1)and(n==1))
    {
        cout<<"NO";
    }
    else if(con>1)//and(cov))
        {
            cout<<"NO";
        }
        else if((con=1)and(cov>1))
        {
            cout<<"YES";
        }

}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if((cov==1)and(n==1))
    {
        cout<<"YES";
    }
    else if((con==1)and(n==1))
    {
        cout<<"NO";
    }
    else if(cov==(n-con)and(con==1))
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }

}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if((con==1)and(n==1))
    {
        cout<<"NO";
    }
    else if(con>1)//and(cov))
        {
            cout<<"NO";
        }
        else if(cov==n)
        {
            cout<<"YES";
        }
            else if((con=1)and(cov>1))
            {
                cout<<"YES";
            }

}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if(cov==(n-con))
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }

}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if(cov==(n-con)and(con==1))
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO";
    }

}


#include <iostream>

using namespace std;

int main()
{
    int n,con(0),cov(0);
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            con++;
        }
        else
        {
            cov++;
        }

    }
    if(cov==(n-con))
    {
        cout<<"YES";
    }
    else
    {
        cout<<"NO"
    }

}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<int> v;

	for(int i = 0; i < n; i++)
	{
		int k;
		cin >> k;
		v.push_back(k);
	}

	int dem = 0;
	if(v.size() == 1)
	{
		if(v[0] == 0)
		{
			cout << "NO";
			return 0;

		}
		if(v[0] == 1)
		{
			cout << "YES";
			return 0;
		}
	}
	for(int i = 0; i < v.size(); i++)
	{
		if(v[i] == 0)
		{
			dem++;
		}
	}
	if(dem > 1 || dem == 0)
	{
		cout <<"NO";
	}
	else if(dem == 1)
	{
		cout <<"YES";
	}

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
	vector<int> v;
	int n;
	cin >> n;

	for(int i = 0; i < n; i++)
	{
		int k;
		cin >> k;
		v.push_back(k);
	}
	int So = v.size();
	for(int i = 0; i < So - 1; i++)
	{
		if(So == 1 && v[0] == 1)
		{
			cout <<"YES";
			return 0;
		}
		else if(So == 1 && v[0] == 0)
		{
			cout <<"NO";
			return 0;
		}
		if(v[i] == 1 && v[i+1] == 0 || v[i] == 0 && v[i+1] == 1)
		{
			cout <<"YES";
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
	vector<int> v;
	int n;
	cout <<"\nInput : ";
	cin >> n;

	for(int i = 0; i < n; i++)
	{
		cout <<"\nInput v[" << i << "]=";
		int k;
		cin >> k;
		v.push_back(k);
	}
	int So = v.size();
	for(int i = 0; i < So - 1; i++)
	{
		if(So == 1 && v[0] == 1)
		{
			cout <<"\nYES";

			return 0;
		}
		else if(So == 1 && v[0] == 0)
		{
			cout <<"\nNO";

			return 0;
		}
		if(v[i] == 1 && v[i+1] || v[i] == 0 && v[i+1] == 1)
		{
			cout <<"\nYES";
		}
	}

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
	vector<int> v;
	int n;
	cout <<"\nInput : ";
	cin >> n;

	for(int i = 0; i < n; i++)
	{
		cout <<"\nInput v[" << i << "]=";
		int k;
		cin >> k;
		v.push_back(k);
	}
	int So = v.size();
	for(int i = 0; i < So - 1; i++)
	{
		if(So == 1 && v[0] == 1)
		{
			cout <<"YES";
			return 0;
		}
		else if(So == 1 && v[0] == 0)
		{
			cout <<"NO";
			return 0;
		}
		if(v[i] == 1 && v[i+1] || v[i] == 0 && v[i+1] == 1)
		{
			cout <<"YES";
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<int> v;

	for(int i = 0; i < n; i++)
	{
		int k;
		cin >> k;
		v.push_back(k);
	}

	int dem = 0;
	if(v.size() == 1)
	{
		if(v[0] == 0)
		{
			cout << "NO";

		}
		if(v[0] == 1)
		{
			cout << "YES";

		}
	}
	for(int i = 0; i < v.size(); i++)
	{
		if(v[i] == 0)
		{
			dem++;
		}
	}
	if(dem > 1)
	{
		cout <<"NO";
	}
	else
	{
		cout <<"YES";
	}

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<int> v;

	for(int i = 0; i < n; i++)
	{
		int k;
		cin >> k;
		v.push_back(k);
	}

	int dem = 0;
	if(v.size() == 1)
	{
		if(v[0] == 0)
		{
			cout << "NO";

		}
		if(v[0] == 1)
		{
			cout << "YES";

		}
	}
	if(v[v.size() - 1] == 0)
	{
		cout <<"NO";

		return 0;
	}
	for(int i = 0; i < v.size(); i++)
	{
		if(v[i] == 0)
		{
			dem++;
		}
	}
	if(dem > 1)
	{
		cout <<"NO";
	}
	else
	{
		cout <<"YES";
	}

	return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<int> v;

	for(int i = 0; i < n; i++)
	{
		int k;
		cin >> k;
		v.push_back(k);
	}

	int dem = 0;
	if(v.size() == 1)
	{
		if(v[0] == 0)
		{
			cout << "NO";

		}
		if(v[0] == 1)
		{
			cout << "YES";

		}
	}
	for(int i = 0; i < v.size(); i++)
	{
		if(v[i] == 0)
		{
			dem++;
		}
	}
	if(dem > 1 || dem == 0)
	{
		cout <<"NO";
	}
	else if(dem == 1)
	{
		cout <<"YES";
	}

	return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,tmp,sum = 0;scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);
        sum += tmp;
    }
    if((sum == n-1 || n == 1) && tmp == 1) printf("YES");else printf("NO");
    return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,tmp,sum = 0;scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);sum += tmp;
    }
    if(sum >= n-1 || n == 1)printf("YES");else printf("NO");
    return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,sum,tmp;scanf("%d",&n);sum = max(n-1,1);
    while(n--){
        scanf("%d",&tmp);
        sum -= tmp;
    }
    printf("%s",((sum)?"NO":"YES"));
    return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,tmp,sum = 0;scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);sum += tmp;
    }
    if(sum == n-1 || n == 1)printf("YES");else printf("NO");
    return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,tmp,sum = 0;scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);sum += tmp;
    }
    if(sum == n-1)printf("YES");else printf("NO");
    return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,tmp,sum = 0;scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);
        sum += tmp;
    }
    if(sum == n-1 || (n == 1 && tmp == 1)) printf("YES");else printf("NO");
    return 0;
}


#include <stdio.h>
#include <algorithm>
using namespace std;
int main(){
    int n,sum,tmp;scanf("%d",&n);sum = max(n-1,1);
    while(n--){
        scanf("%d",&tmp);
        sum -= tmp;
    }
    printf("%s",((sum)?"NO":"YES"));
    return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,tmp,sum = 0;scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);
        sum += tmp;
    }
    if((sum == n-1 || (n == 1 && tmp == 1)) printf("YES");else printf("NO");
    return 0;
}


#include <stdio.h>
using namespace std;
int main(){
    int n,tmp;scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&tmp);
        if(tmp == 1 && i == n-1){printf("YES");return 0;}
    }
    printf("NO");
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;

int main()
{
  int i,j,n,k=0;
  cin>>n;

  int a[n];

  for(i=0;i<n;i++)
  {
    cin>>a[i];

    if(a[i]==0){
      k++;
     }
  }

  if(n==1 && a[0]==0)
  {
    cout<<"NO\n";
    return 0;
  }

  if(k>1)
  {
    cout<<"NO\n";
  }
  else
    cout<<"YES\n";
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;

int main()
{
  int i,j,n,k=0;
  cin>>n;

  int a[n];

  for(i=0;i<n;i++)
  {
    cin>>a[i];

    if(a[i]==0){
      k++;
     }
  }

  if(n==1 && a[0]==0)
  {
    cout<<"NO\n";
    return 0;
  }

  if(k>1 || (k==0 && n>1))
  {
    cout<<"NO\n";
  }
  else
    cout<<"YES\n";
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;

int main()
{
  int i,j,n,k=0;
  cin>>n;

  int a[n];

  for(i=0;i<n;i++)
  {
    cin>>a[i];

    if(a[i]==0){
      k++;
     }
  }

  if(k!=1 || (n==1 && a[0]==0))
  {
    cout<<"NO\n";
  }
  else
    cout<<"YES\n";
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;

int main()
{
  int i,j,n,k=0;
  cin>>n;

  int a[n];

  for(i=0;i<n;i++)
  {
    cin>>a[i];

    if(a[i]==0){
      k++;
     }
  }

  if(k>1 || (a[n-1]==0 || k==0))
  {
    cout<<"NO\n";
  }
  else
    cout<<"YES\n";
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;

int main()
{
  int i,j,n,k=0,in;
  cin>>n;

  int a[n];

  for(i=0;i<n;i++)
  {
    cin>>a[i];
    if(a[i]==0){
      k++;
     }
  }

  if(k>1 || a[n-1]==0)
  {
    cout<<"NO\n";
  }
  else
    cout<<"YES\n";
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;

int main()
{
  int i,j,n,k=0;
  cin>>n;

  int a[n];

  for(i=0;i<n;i++)
  {
    cin>>a[i];

    if(a[i]==0){
      k++;
     }
  }

  if(n==1 && a[0]==0)
  {
    cout<<"NO\n";
    return 0;
  }

  if(k!=1)
  {
    cout<<"NO\n";
  }
  else
    cout<<"YES\n";
  return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#define MOD 1000000007
using namespace std;

int main()
{
  int i,j,n,k=0;
  cin>>n;

  int a[n];

  for(i=0;i<n;i++)
  {
    cin>>a[i];

    if(a[i]==0){
      k++;
     }
  }

  if(k!=1)
  {
    cout<<"NO\n";
  }
  else
    cout<<"YES\n";
  return 0;
}


#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    int t;
    for(int i = 0; i < n; i++){
        cin >> t;
        if(t){
            cnt++;
        }
    }
    if(cnt == n-1 && t != 0){
        cout << "YES";
    }else if(n == 1 && cnt == 1){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    int t;
    for(int i = 0; i < n; i++){
        cin >> t;
        if(!t){
            cnt++;
        }
    }
    if(n == 1 && cnt == 0){
        cout << "YES";
    }else if(n != 1 && (cnt == 1 || cnt == 0)){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    int t;
    for(int i = 0; i < n; i++){
        cin >> t;
        if(!t){
            cnt++;
        }
    }
    if(cnt == 1){
        cout << "YES";
    }else if(n == 1 && cnt == 0){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int t;
        cin >> t;
        if(t){
            cnt++;
        }
    }
    if(cnt == n-1 || cnt == n){
        cout << "YES";
    }else if(n == 1 && cnt == 1){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    int t;
    for(int i = 0; i < n; i++){
        cin >> t;
        if(!t){
            cnt++;
        }
    }
    if(n == 1 && cnt == 0){
        cout << "YES";
    }else if(n != 1 && (cnt == 1)){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int t;
        cin >> t;
        if(t){
            cnt++;
        }
    }
    if(cnt == n-1 && t != 0){
        cout << "YES";
    }else if(n == 1 && cnt == 1){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int t;
        cin >> t;
        if(t){
            cnt++;
        }
    }
    if(cnt == n-1){
        cout << "YES";
    }else if(n == 1 && cnt == 1){
        cout << "YES";
    }else{
        cout << "NO";
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }

    if(r==1||r==0)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }
    if(n=1&&a[n]==1){
    cout<<"YES"<<endl;
    }
    else if(r==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n-1;i++){
        if(a[i]==0)
            r++;
    }
    cout<<r<<endl;
    if (n==1&&a[0]==1){
        cout<<"YES"<<endl;
    }
    else if(r==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }
    if(r==1||n==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[1111];
    int i,n,r=0;

    cin>>n;

    for(i=0;i<n;i++){
        cin>>a[i];
    }
    if(n==1){
        if(a[0]==1)
        cout<<"YES"<<endl;
        else
        cout<<"NO"<<endl;
        return 0;
    }
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }
    if(r==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }
    if(r==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }

     if(r<=1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[1111];
    int i,n,r=0;

    cin>>n;

    for(i=0;i<n;i++){
        cin>>a[i];
    }
    if(n==1&&a[0]==1){
        cout<<"YES"<<endl;
        return 0;
    }
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }
    if(r==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n;i++){
        if(a[i]==0)
            r++;
    }
    if(r==1||n==0)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n-1;i++){
        if(a[i]==0)
            r++;
    }

    if(r==1||r==0)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n-1;i++){
        if(a[i]==0)
            r++;
    }
    cout<<r<<endl;
    if(r==1||n==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int a[10001],n,i;

    cin>>n;

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

    int r=0;
    for(i=0;i<n-1;i++){
        if(a[i]==0)
            r++;
    }
    if(n==1&&a[0]==1){
        cout<<"YES"<<endl;
    }
    else if(r==1)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


#include "iostream"
#include "vector"

int main(int argc, char ** argv) {
	int number = 0;
	int currentNumber = 0;
	int sum = 0;

	std::cin >> number;
	for (int i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += currentNumber;
	}

	std::cout << sum;

	if (((number == 1) && (sum == 1)) || (number - 1 == sum)) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include "iostream"
#include "vector"

int main(int argc, char ** argv) {
	unsigned short number = 0;
	unsigned char currentNumber = 0;
	unsigned short sum = 0;

	std::cin >> number;
	for (unsigned short i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += (currentNumber != 0) ? 1 : 0;
	}

	if (((number == 1) && (sum == 1)) || (number - 1 == sum)) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include "iostream"
#include "vector"

int main(int argc, char ** argv) {
	unsigned short number = 0;
	unsigned short currentNumber = 0;
	unsigned short sum = 0;

	std::cin >> number;
	for (unsigned short i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += (currentNumber != 0) ? 1 : 0;
	}

	if (((number == 1) && (sum == 1)) || ((number != 1) && (number - 1 == sum))) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include "iostream"
#include "vector"

int main(int argc, char ** argv) {
	int number = 0;
	int currentNumber = 0;
	int sum = 0;

	std::cin >> number;
	for (int i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += currentNumber;
	}

	if (((number == 1) && (sum == 1)) || (number - 1 == sum)) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include "iostream.h"
#include "vector"

int main(int argc, char ** argv) {
	int number = 0;
	int currentNumber = 0;
	int sum = 0;

	std::cin >> number;
	for (int i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += currentNumber;
	}

	if ((n == 1) && (currentNumber == 1) || (n - 1 == currentNumber)) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include "iostream"
#include "vector"

int main(int argc, char ** argv) {
	unsigned short number = 0;
	unsigned short currentNumber = 0;
	unsigned short sum = 0;

	std::cin >> number;
	for (unsigned short i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += (currentNumber != 0) ? 1 : 0;
	}

	if (((number == 1) && (sum == 1)) || (number - 1 == sum)) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include "iostream"
#include "vector"

int main(int argc, char ** argv) {
	int number = 0;
	int currentNumber = 0;
	int sum = 0;

	std::cin >> number;
	for (int i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += (currentNumber != 0) ? 1 : 0;
	}

	if (((number == 1) && (sum == 1)) || (number - 1 == sum)) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include "iostream"
#include "vector"

int main(int argc, char ** argv) {
	int number = 0;
	int currentNumber = 0;
	int sum = 0;

	std::cin >> number;
	for (int i = 0; i < number; i++) {
		std::cin >> currentNumber;
		sum += currentNumber;
	}

	if (((number == 1) && (currentNumber == 1)) || (number - 1 == currentNumber)) {
		std::cout << "YES";
	} else {
		std::cout << "NO";
	}

	return 0;
}


#include<stdio.h>

int main()
  {
    int n,i,k;
    int a[1000];

    scanf("%d",&n);
    k=0;
    for(i=0;i<n;i++)
      {
        scanf("%d",&a[i]);
        if(a[i]==0)
          k=k+1;
      }
    if(k==1)
        {
          if(n==1)
            printf("NO");
          else
            printf("YES");
        }
    else
      printf("NO");

    return 0;
  }


#include <stdio.h>
#define MAX 100

int main()
{
	int n;
	int d=0;
	int i;
	int a[1000];
	scanf("%d", &n);
	for(i=0;i<n;i++)
	{
		scanf("%d", &a[i]);
		if(a[i]==0)
			d++;

	}
		if(n>1)
		{
			if(d==1)
				printf("YES");
			if(d!=1)
				printf("NO");

		}
		if(n==1)
		{
				if(a[i]==1)
					printf("YES");
				else
					printf("NO");
		}

	return 0;
}


//cho mang 1 chieu co n pt gia tri mang co 1 va 0
#include<stdio.h>
int main()
{
	int n,a[1000];
	scanf("%d",&n);
	int i;int dem=0;
	if(n==1)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==1)
				printf("Yes");
			else
				printf("No");
		}
	}
	else
	{
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		if(a[i]==0)
			dem++;
	}
	if(dem==1)
		printf("Yes");
	else
		printf("No");
	}
	return 1;
}


#include<stdio.h>

void nhapn(int &n)
{

	scanf("%d",&n);
}
void nhapmang(int a[],int n)
{
	int i;
	for(i=0;i<n;i++)
	{

		scanf("%d",&a[i]);
	}
}
void xuatmang(int a[],int n)
{
	int i;
	for(i=0;i<n;i++)
	{
		//printf("\t%d",a[i]);
	}
}
void xuat(int a[],int n)
{
	int dem1=0;
	int dem0=0;
	if(n!=1)
	{
		for(int i=0;i<n;i++)
		{
			if(a[i]==0)
			{
				dem0++;
			}
			if(a[i]==1)
			{
				dem1++;
			}
		}
		if(dem0==1)
		{
			printf("YES");
		}
		else
		{
			printf("NO");
		}
	}
	else
	{
		if(a[0]==1)
		{
			printf("YES");
		}
		if(a[0]==0)
		{
			printf("NO");
		}
	}
}
int main()
{
	int n;
	int a[1000];
	nhapn(n);
	nhapmang(a,n);
	xuatmang(a,n);
	xuat(a,n);

	return 0;
}


#include<stdio.h>
int main()
{
	int a[1000];
	int n,i;
	int dem=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	if(n==1)
	{
		if(a[0]==1)
			printf("YES");
		else
			printf("NO");
	}
	else
	{
		for(i=0;i<n;i++)
		{
			if(a[i]==0)
				dem++;
		}
		if(dem==1)
			printf("YES");
		else
			printf("NO");
	}

	return 0;

}


#include<stdio.h>
int main()
{
	int a[5];
	int n, i, j;
	int t=0;
	int tong=0;
	nhapN (n);
	nhapmang (a,n);
	xuatmang (a,n);

	for(i=0;i<n;i++)
		//scanf("%d", &a[i]);
		if(a[i]==0)
			t=t+1;
				if(t==1)
					printf("YES");
				else
					printf("NO");

	//printf("%d", t-k);
	//sosanh(a, n);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,i;
	int dem = 0+1-1;
	int a[1000];
	scanf("%d",&n);
	if(n==1)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		if(a[0]==1)
		{
			printf("YES");
		}
		else
			printf("NO");
	}
	else
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
			if(a[i]==0)
				dem++;
		}
		if(dem==0||dem>1)
			printf("NO");
		else
			printf("YES");
		return 0;
}


#include<stdio.h>
int main()
{
	int n,a[1000];
	scanf("%d",&n);
	int i;int dem=0;
	if(n==1)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==1)
				printf("YES");
			else
				printf("NO");
		}
	}
	else
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==0)
				dem++;
		}
		if(dem==1)
			printf("YES");
		else
			printf("NO");
	}
	return 0;
}


#include<stdio.h>

int main()
{
	int i,n;
	int a[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	if(n==1)
	{
		if(a[0]==1)
			printf("YES");
		else
			printf("NO");
	}
	int dem=0;
	if(n>1)
	{
		for(i=0;i<n;i++)
		{
			if(a[i]==0)
				dem++;
		}

		if(dem==1)
			printf("YES");
		else
			printf("NO");
	}

	return 0;
	}


#include<stdio.h>

int main()
  {
    int n,i,k;
    int a[1000];

    scanf("%d",&n);
    k=0;
    for(i=0;i<n;i++)
      {
        scanf("%d",&a[i]);
        if(a[i]==0)
          k=k+1;
      }

    if(k>1)
      printf("NO");
    else
      if(k==1)
        {
          if(n==1)
            printf("NO");
          else
            printf("YES");
        }
      else
        printf("YES");

    return 0;
  }


#include <stdio.h>

int main()
{
    int n,i,dem=0;
    int a[1000];
	scanf("%d", &n);
    for(i=0; i < n; i++)
	{
		scanf("%d",&a[i]);
	}
	if(n==1)
	{
		if(a[0]==1)
		printf("yes");
		else
		printf("no");
	}
	else
	{
		for(i=0;i<n;i++)
		{
			if(a[i]==0)
			dem++;
		}
		if(dem==1)
			printf("yes");
		else
			printf("no");
	}

 	return 0;
 }


#include<stdio.h>

int main()
{
	int n,i;
	int dem = 0;
	int a[1000];
	scanf("%d",&n);
	if(n==1)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		if(a[0]==1)
		{
			printf("YES");
		}
		else
			printf("NO");
	}
	else
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
			if(a[i]==0)
				dem++;
		}
		if(dem==0||dem>1)
			printf("NO");
		else
			printf("YES");
		return 0;
}


#include<stdio.h>

int main()
{
	int i,dem,n;
	int a[1000];
	dem=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	if(n=1)
	{
		if(a[0]==1)
			printf("YES");
		else
			printf("NO");
	}
	if(n>1)
	{
		for(i=0;i<n;i++)
		{
			if(a[i]==0)
				dem=dem++;
		}
		if(dem==1)
			printf("YES");
		else
			printf("NO");
	}

	return 0;
	}


#include<stdio.h>

int main()
{

	int n,x=0;
	int a[1000];
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		do
		{
		scanf("%d", &a[i]);
		if(a[i]==0)
			x++;

		}
		while (a[i]!=0&a[i]!=1);
	}
	if(n==1)
		if(a[0]==1)
			printf("Yes");
		else
			printf("No");
	else
		if(x==1)
			printf("Yes");
		else
			printf("No");
		return 0;

}


#include<stdio.h>

int main()
{

	int n,x=0;
	int a[1000];
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		do
		{
		scanf("%d", &a[i]);
		if(a[i]==0)
			x++;

		}
		while (a[i]!=0&a[i]!=1);
	}
	if(n==1)
		if(a[0]==1)
			printf("YES");
		else
			printf("NO");
	else
		if(x==1)
			printf("YES");
		else
			printf("NO");
		return 0;

}


#include<stdio.h>

int main()
  {
    int n,i,k;
    int a[1000];

    scanf("%d",&n);
    k=0;
    for(i=0;i<n;i++)
      {
        scanf("%d",&a[i]);
        if(a[i]==0)
          k=k+1;
      }
    if(k==1)
        {
          if(n==1)
            printf("NO");
          else
            printf("YES");
        }
    else
      printf("YES");

    return 0;
  }


#include<stdio.h>
int main()
{
	int n,a[1000];
	scanf("%d",&n);
	int i;
	int d=0;

	if(n==1)
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++)
		{
			if(a[i]!=1)
				printf("NO");
			else
				printf("YES");
		}
	}
	else
	{
		for(i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=0;i<n;i++)
		{
			if(a[i]==0)
				d++;
		}
		if(d==1)
			printf("YES");
		else
			printf("NO");
	}
	return 0;
}


#include<stdio.h>

int main()
{
	int i,dem,n;
	int a[1000];
	dem=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	if(n=1)
	{
		if(a[0]==1)
			printf("YES");
		else
			printf("NO");
	}
	if(n>1)
	{
		for(i=0;i<n;i++)
		{
			if(a[i]==0)
				dem=dem++;
		}
		if(dem!=1)
			printf("NO");
		else
			printf("YES");
	}

	return 0;
	}


#include<stdio.h>

int main()
  {
    int n,i,k;
    int a[1000];

    scanf("%d",&n);
    k=0;
    for(i=0;i<n;i++)
      {
        scanf("%d",&a[i]);
        if(a[i]==0)
          k=k+1;
      }
    if(k==1)
        {
          if(n==1)
            printf("NO");
          else
            printf("YES");
        }
    else
        {
          if(n==1)
            printf("YES");
          else
            printf("NO");
        }

    return 0;
  }


#include<stdio.h>

int main()
  {
    int n,i,k;
    int a[1000];

    scanf("%d",&n);
    k=0;
    for(i=0;i<n;i++)
      {
        scanf("%d",&a[i]);
        if(a[i]==0)
          k=k+1;
      }

    if(k>1)
      printf("NO");
    else
      if(k==1)
        {
          if((a[n-1]==0)||(n==1))
            printf("NO");
          else
            printf("YES");
        }
      else
        printf("YES");

    return 0;
  }


/*                     Hello in my world.
 I love a success people .
 I love Robotics,Electronics,Atrficial Intelegance and Programming.
 The time has an amazing surprises for me and I will prepare to these days to be in the top of success.
 The life is hard ,but Engineering is harder(But I still love it).
 You and You only will have an intresting in your dreams.
 All difficult days,situations will make you to be in the top and I mean that word in the Top!!!
                     ****Hunter of flams************
******************** The Genuis Robot *********************              */

#include<map>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n ; cin>>n ;
    vector<int>v;
    v.push_back(0);
    if(n==1) {cout<<-1; return 0 ;}
   if(n%2==0){
    int x=2,y=1;
    for(int i=0;i<n/2;i++){
        v.push_back(x+i*2);v.push_back(y+i*2);
    }
   }
   if(n%2!=0)
 {
    int x=2,y=1;
    for(int i=0;i<n/2-1;i++){
    v.push_back(x+i*2);
    v.push_back(y+i*2);
    }
 v.push_back(n-1);v.push_back(n);v.push_back(n-2);
 }
 for(int i=1;i<=n;i++){
     if(v[v[i]]!=i) {cout<<-1;return 0 ;}
 }

 for(int i=1;i<n+1;i++){
 cout<<v[i]<<' ';
 }
    return 0;
}


/*                     Hello in my world.
 I love a success people .
 I love Robotics,Electronics,Atrficial Intelegance and Programming.
 The time has an amazing surprises for me and I will prepare to these days to be in the top of success.
 The life is hard ,but Engineering is harder(But I still love it).
 You and You only will have an intresting in your dreams.
 All difficult days,situations will make you to be in the top and I mean that word in the Top!!!
                     ****Hunter of flams************
******************** The Genuis Robot *********************              */

#include<map>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int a[101];
int main() {
    int n ; cin>>n ;
    if(n==1) {cout<<-1; return 0 ;}
   if(n%2==0){
    int x=2,y=1;
    for(int i=0;i<n/2;i++){
        cout<<x+i*2<<' '<<y+i*2<<' ';
    }
   }
   if(n%2!=0)
 {
      int x=2,y=1;
    for(int i=0;i<n/2-1;i++){
    cout<<x+i*2<<' '<<y+i*2<<' ';
    }
 cout<<n-1<<' '<<n<<' '<<n-2;
 }
    return 0;
}


/*                     Hello in my world.
 I love a success people .
 I love Robotics,Electronics,Atrficial Intelegance and Programming.
 The time has an amazing surprises for me and I will prepare to these days to be in the top of success.
 The life is hard ,but Engineering is harder(But I still love it).
 You and You only will have an intresting in your dreams.
 All difficult days,situations will make you to be in the top and I mean that word in the Top!!!
                     ****Hunter of flams************
******************** The Genuis Robot *********************              */

#include<map>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n ; cin>>n ;
    if(n%2!=0) {cout<<-1;return 0 ;}

    for(int i=1;i<n;i+=2){
        cout<<i+1<<' '<<i;
    }
    return 0;
}


/*                     Hello in my world.
 I love a success people .
 I love Robotics,Electronics,Atrficial Intelegance and Programming.
 The time has an amazing surprises for me and I will prepare to these days to be in the top of success.
 The life is hard ,but Engineering is harder(But I still love it).
 You and You only will have an intresting in your dreams.
 All difficult days,situations will make you to be in the top and I mean that word in the Top!!!
                     ****Hunter of flams************
******************** The Genuis Robot *********************              */

#include<map>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n ; cin>>n ;
    if(n%2!=0) {cout<<-1;return 0 ;}

    for(int i=1;i<n;i+=2){
        cout<<i+1<<' '<<i<<' ';
    }
    return 0;
}


/*                     Hello in my world.
 I love a success people .
 I love Robotics,Electronics,Atrficial Intelegance and Programming.
 The time has an amazing surprises for me and I will prepare to these days to be in the top of success.
 The life is hard ,but Engineering is harder(But I still love it).
 You and You only will have an intresting in your dreams.
 All difficult days,situations will make you to be in the top and I mean that word in the Top!!!
                     ****Hunter of flams************
******************** The Genuis Robot *********************              */

#include<map>
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>
#include <bits/stdc++.h>
using namespace std;
int a[101];
int main() {
    int n ; cin>>n ;
    if(n==1) {cout<<-1; return 0 ;}
   if(n%2==0){
    int x=2,y=1;
    for(int i=0;i<n/2;i++){
        cout<<x+i*2<<' '<<y+i*2<<' ';
    }
   }
   if(n%2!=0)
 {
      int x=2,y=1;
    for(int i=0;i<n/2-1;i++){
    cout<<x+i*2<<' '<<y+i*2<<' ';
    }
   }

 cout<<n-1<<' '<<n<<' '<<n-2;
    return 0;
}


#include<iostream>
using namespace std;
int main(){
	int n,m;cin>>n;
	if(n%2!=0){
		cout<<"-1"<<endl;
	}else{
	 for(int i=1;i<=n;i++){
		 if(i%2==0){
		    m=i-1;
	    } else{
	   	   m=i+1;
	    }
	    cout<<m<<",";
	 }
    }
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n;
    if(n%2==0){
	 for(int i=1;i<=n;i++){
	     if(i%2==0){
		    m=i-1;
	    } else{
	   	   m=i+1;
	    }
	    cout<<m<<" ";
	 }
    }else{
              cout<<"-1"<<endl;
    }
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int n,m;
	cin>>n;
    if(n%2==0){
	 for(int i=1;i<=n;i++){
	     if(i%2==0){
		    m=i-1;
	    } else{
	   	   m=i+1;
	    }
	    cout<<m<<",";
	 }

    }else{
              cout<<"-1"<<endl;
    }
	return 0;
}


#include<iostream>
using namespace std;
int main(){
	int n,m;cin>>n;
	if(n%2!=0){
		cout<<"-1"<<endl;
	}else{
	 for(int i=1;i<=n;i++){
		 if(i%2==0){
		    m=i-1;
	    } else{
	   	   m=i+1;
	    }
	    cout<<m<<",";
	 }
    }

	return 0;
}


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

int main ()
{
   int n;
   cin>>n;

   if (n%2!=0)
   {
       cout<<"-1"<<endl;
   }
   else
   {
       for (int i=n-1;i>=0;i--)
       {
           cout<<i+1<<" ";
       }

       cout<<endl;
   }
}


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

int main ()
{
   int n;
   cin>>n;

   int ar[n];

   if (n==1)
   cout<<-1<<endl;

   else
   {
       int k=0;
       for (int i=n-1;i>=0;i--)
       {
          ar[k++]=i+1;
       }

       if (n%2!=0)
       {
           int t= ar[n/2];
           ar[n/2]=ar[(n/2)+1];
           ar[(n/2)+1]=t;
       }

       for (int i=0;i<n;i++)
       {
           cout<<ar[i]<<" ";
       }
       cout<<endl;
   }
}


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

int main ()
{
   int n;
   cin>>n;

   if (n==1)
   cout<<-1<<endl;

   else
   {
       for (int i=n-1;i>=0;i--)
       {
           cout<<i+1<<" ";
       }

       cout<<endl;
   }
}


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

int main ()
{
   int n;
   cin>>n;

   int ar[n];

   if (n==1)
   cout<<-1<<endl;

   else
   {
       for (int i=n-1;i>=0;i--)
       {
          ar[i]=i+1;
       }

       int t= ar[n/2];
       ar[n/2]=ar[n/2+1];
       ar[n/2+1]=t;

       for (int i=0;i<n;i++)
       {
           cout<<ar[i]<<" ";
       }
       cout<<endl;
   }
}


#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n;


#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n;
	cin>>n;
	if(n%2==1){
	cout<<"-1"<<endl;return 0;}
	for(int i=1;i<=n;i+=2)
        cout<<i+1<<" "<<i<<" ";
        return 0;

}


#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n;
	cin>>n;
	if(n==1)
	cout<<"-1"<<endl;
	else
	{
	    for(int i=0;i<n;i++)
	    cout<<n-i<<" ";cout<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n;
	cin>>n;
	int arr[n+2]={n};
	if(n==1){
	cout<<"-1"<<endl;return 0;}
	else
	{
	    if(n%2==0)
	    {
	        for(int i=1;i<=n;i+=2)
	        cout<<i+1<<" "<<i<<" ";
	        return 0;
	    }
	    else
	    {
	        for(int i=1;i<=n;i+=2)
	            {arr[i]=i+1;arr[i+1]=i;}
	           int temp=arr[n];
	        arr[n]=arr[n+1];
	        arr[n+1]=temp;
	         temp=arr[n];
	        arr[n]=arr[n-1];
	        arr[n-1]=temp;
	    }
	}
	for(int i=1;i<=n;i++)
	cout<<arr[i]<<" ";cout<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n;
	cin>>n;
	int arr[n+2]={n};
	if(n==1){
	cout<<"-1"<<endl;return 0;}
	else
	{
	    if(n%2==0)
	    {
	        for(int i=1;i<=n;i+=2)
	        cout<<i+1<<" "<<i<<" ";
	        return 0;
	    }
	    else
	    {
	        for(int i=1;i<=n;i+=2)
	            {arr[i]=i+1;arr[i+1]=i;}
	           int temp=arr[n];
	        arr[n]=arr[n+1];
	        arr[n+1]=temp;
	         temp=arr[n];
	        arr[n]=arr[n-1];
	        arr[n-1]=temp;


#include <bits/stdc++.h>
using namespace std;
int main() {
	// your code goes here
	int n;
	cin>>n;
	int arr[n+2]={n};
	if(n==1){
	cout<<"-1"<<endl;return 0;}
	else
	{
	    if(n%2==0)
	    {
	        for(int i=1;i<=n;i+=2)
	        cout<<i+1<<" "<<i;
	        return 0;
	    }
	    else
	    {
	        for(int i=1;i<=n;i+=2)
	            {arr[i]=i+1;arr[i+1]=i;}
	           int temp=arr[n];
	        arr[n]=arr[n+1];
	        arr[n+1]=temp;
	         temp=arr[n];
	        arr[n]=arr[n-1];
	        arr[n-1]=temp;
	    }
	}
	for(int i=1;i<=n;i++)
	cout<<arr[i]<<" ";cout<<endl;
	return 0;
}


#include<stdio.h>
int main(int argc, char *argv[])
{
	int n,i;
	scanf("%d",&n);
	if(n%2==0) printf("-1");
	else{
	for(i=n;i>0;i--){
		printf("%d ",i);
	}
	}
	return 0;
}


#include<stdio.h>
int main(int argc, char *argv[])
{
	int n,i;
	scanf("%d",&n);
	if(n==1) printf("-1");
	else{
	for(i=n;i>0;i--){
		printf("%d ",i);
	}
	}
	return 0;
}


#include<stdio.h>
int main(int argc, char *argv[])
{
	int n,i;
	scanf("%d",&n);
	if(n==1) printf("-1");
	else{
	for(i=n;i>0;i--){
		printf("%d ",i);
	}
	}
	return 0;


#include<stdio.h>
int main(int argc, char *argv[])
{
	int n,i;
	scanf("%d",&n);
	if(n%2!=0) printf("-1");
	else{
	for(i=n;i>0;i--){
		printf("%d ",i);
	}
	}
	return 0;
}


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

int main()
{
    int num;
    cin>>num;
    if(num<=1) {
        cout<<-1<<endl;
        return 0;
    }
    int arr[num];
    for(int i=0;i<num;i++) {
        arr[i]=i+1;
    }
    for(int i=0;i<num-1;i++) {
        swap(arr[i],arr[i+1]);
        if(i<num-1) i++;
        else continue;
    }
    for(int i=0;i<num;i++)
        cout<<arr[i]<<" ";

    return 0;
}


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

int main()
{
    int num;
    cin>>num;
    if(num<=1) {
        cout<<-1<<endl;
        return 0;
    }
    int arr[num];
    for(int i=0;i<num;i++) {
        arr[i]=i+1;
    }
    for(int i=0;i<num;i++) {
        swap(arr[i],arr[i+1]);
        i++;
    }
    for(int i=0;i<num;i++)
        cout<<arr[i]<<" ";

    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    if(n%2==1) {
        cout<<-1<<endl;
        return 0;
    }
    else {
        cout<<2<<" "<<1;
        for(int i=3;i<n;i+=2)
            cout<<" "<<i+1<<" "<<i;
        cout<<endl;
    }

    return 0;
}


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

int main()
{
    int num;
    cin>>num;
    if(num<=1) {
        cout<<-1<<endl;
        return 0;
    }
    int arr[num];
    for(int i=0;i<num;i++) {
        arr[i]=i+1;
    }
    for(int i=0;i<num-1;i++) {
        swap(arr[i],arr[i+1]);
        i++;
    }
    for(int i=0;i<num;i++)
        cout<<arr[i]<<" ";

    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    if(n%2==1) {
        cout<<-1<<endl;
        return 0;
    }
    else {
        cout<<"2 1"<<" ";
        for(int i=3;i<n;i+=2)
            cout<<i+1<<" "<<i;
    }

    return 0;
}


/*

     بسم الله

     الموظف لا يكسب

*/

#include <bits/stdc++.h>

using namespace std;

#define Khan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define ONE exit(0);
#define nl "\n"

#define ff first
#define ss second

#define ub upper_bound
#define lb lower_bound

#define pb push_back
#define ppb pop_back

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

typedef long long LL;

//#define int long long
//#define int double

const int N = 1e3 + 5;
const int M = 1e9 + 7;

int n;
main()
{

//     تتحقق الأحلام إذا كان الهدف مستداما

     //freopen(".in", "r", stdin);
     //freopen(".out", "w", stdout);

     Khan

     cin >> n;
     if(n % 2 != 0){
          cout << "-1" << nl;
          ONE
     }
     for(int i = n; i >= 1; --i){
          cout << i << ' ';
     }
     ONE
}


// Beygut Beysenkhan
// 14.11.2017  08:25:00
// I CAN

#include <bits/stdc++.h>

using namespace std;

#define KHAN  ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define bbb return 0;
#define nl "\n"

typedef long long LL;

const int N = 1e4 + 2;
const int M = 1e9 + 7;

int n;
int main()
{
     KHAN

     cin >> n;
     if(n == 1 || n == 3){
          cout << "-1" << nl;
          bbb
     }
     if(n == 2){
          cout << 2 << " " << 1 << nl;
          bbb
     }
     for(int i = n / 2; i >= 1; i--){
          cout << i << " ";
     }
     for(int i = n; i >= n / 2 + 1; i--){
          cout << i << " ";
     }
     bbb
}

// Beygut Beysenkhan
// I CAN


// Beygut Beysenkhan
// 14.11.2017  08:25:00
// I CAN

#include <bits/stdc++.h>

using namespace std;

#define KHAN  ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define bbb return 0;
#define nl "\n"

typedef long long LL;

const int N = 1e4 + 2;
const int M = 1e9 + 7;

int n;
int main()
{
     KHAN

     cin >> n;
     if(n == 1 || n == 3 || n == 7){
          cout << "-1" << nl;
          bbb
     }
     if(n == 2){
          cout << 2 << " " << 1 << nl;
          bbb
     }
     for(int i = n / 2; i >= 1; i--){
          cout << i << " ";
     }
     for(int i = n; i >= n / 2 + 1; i--){
          cout << i << " ";
     }
     bbb
}

// Beygut Beysenkhan
// I CAN


// Beygut Beysenkhan
// 14.11.2017  08:25:00
// I CAN

#include <bits/stdc++.h>

using namespace std;

#define KHAN  ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define bbb return 0;
#define nl "\n"

typedef long long LL;

const int N = 1e4 + 2;
const int M = 1e9 + 7;

int n;
int main()
{
     KHAN

     cin >> n;
     if(n == 1 || n == 3 || n == 7){
          cout << "-1" << nl;
          bbb
     }
     if(n == 2){
          cout << 2 << " " << 1 << nl;
          bbb
     }
     if(n % 2 == 0){
          for(int i = n; i >= 1; i--){
               cout << i << " ";
          }
          bbb
     }
     for(int i = n / 2; i >= 1; i--){
          cout << i << " ";
     }
     for(int i = n; i >= n / 2 + 1; i--){
          cout << i << " ";
     }
     bbb
}

// Beygut Beysenkhan
// I CAN


// Beygut Beysenkhan
// 14.11.2017  08:25:00
// I CAN

#include <bits/stdc++.h>

using namespace std;

#define KHAN  ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define bbb return 0;
#define nl "\n"

typedef long long LL;

const int N = 1e4 + 2;
const int M = 1e9 + 7;

int n;
int main()
{
     KHAN

     cin >> n;
     if(n == 1){
          cout << "-1" << nl;
          bbb
     }
     if(n == 2){
          cout << 2 << " " << 1 << nl;
          bbb
     }
     for(int i = n / 2; i >= 1; i--){
          cout << i << " ";
     }
     for(int i = n; i >= n / 2 + 1; i--){
          cout << i << " ";
     }
     bbb
}

// Beygut Beysenkhan
// I CAN


// Beygut Beysenkhan
// 14.11.2017  08:25:00
// I CAN

#include <bits/stdc++.h>

using namespace std;

#define KHAN  ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define bbb return 0;
#define nl "\n"

typedef long long LL;

const int N = 1e4 + 2;
const int M = 1e9 + 7;

int n;
int main()
{
     KHAN

     cin >> n;
     if(n == 1){
          cout << "-1" << nl;
          bbb
     }
     if(n == 2){
          cout << 2 << " " << 1 << nl;
          bbb
     }
     if(n % 2 == 0){
          for(int i = n / 2; i >= 1; i--){
               cout << i << " ";
          }
          for(int i = n; i >= n / 2 + 1; i--){
               cout << i << " ";
          }
          bbb
     }
     for(int i = n / 2 + 1; i >= 1; i--){
          cout << i << " ";
     }
     for(int i = n; i >= n / 2 + 2; i--){
          cout << i << " ";
     }
     bbb
}

// Beygut Beysenkhan
// I CAN


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if (n==1)
    cout<<"-1";
    else
    {
        cout<<"2 1 ";
        for (int i=3;i<=n;i++)
        {
            cout<<i;
            if (i!=n)
            cout<<" ";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if (n==1)
    cout<<"-1";
    else
    {
        for (int i=1;i<=n;i++)
        {
            if (i%2!=0)
            cout<<i+1;
            else
            cout<<i-1;

            if (n!=i)
            cout<<" ";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if (n!2==1)
    cout<<"-1";
    else
    {
        for (int i=1;i<=n;i++)
        {
            if (i%2!=0)
            cout<<i+1;
            else
            cout<<i-1;

            if (n!=i)
            cout<<" ";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if (n%2==1)
    cout<<"-1";
    else
    {
        for (int i=1;i<=n;i++)
        {
            if (i%2!=0)
            cout<<i+1;
            else
            cout<<i-1;

            if (n!=i)
            cout<<" ";
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if (n==1)
    cout<<"-1";
    else
    {
        cout<<"2 1 ";
        for (int i=3;i<=n;i++)
        {
            if (i!=n)
            cout<<i<<" ";
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define MAX_SIZE 100000000
int main(){
     int n ;
     cin>>n;
     if(n==1) cout<<-1<<endl;
     else{
     vector<int>V;
     for(int i=0;i<n;i++){
         V.push_back(i+1);
     }
     for(int i=0;i<n-1;i++){
         swap(V[i],V[i+1]);
         i++;
     }
     for(int i=0;i<n;i++){
         cout<<V[i]<<" ";
     }
   }
}


#include <bits/stdc++.h>
using namespace std;
#define MAX_SIZE 100000000
int main(){
     int n ;
     cin>>n;
     if(n==1) cout<<-1<<endl;
     else{
     vector<int>V;
     for(int i=0;i<n;i++){
         V.push_back(i+1);
     }
     for(int i=0;i<n-1;i++){
         swap(V[i],V[i+1]);
     }
     for(int i=0;i<n;i++){
         cout<<V[i]<<" ";
     }
   }
}


#include <bits/stdc++.h>
using namespace std;
#define MAX_SIZE 100000000
int main(){
     int n ;
     cin>>n;
     if(n%2!=0) cout<<-1<<endl;
     else{
     vector<int>V;
     for(int i=0;i<n;i++){
         V.push_back(i+1);
     }
     for(int i=0;i<n-1;i++){
         swap(V[i],V[i+1]);
         i++;
     }
     for(int i=0;i<n;i++){
         cout<<V[i]<<" ";
     }
   }
}


#include <bits/stdc++.h>
using namespace std;
#define MAX_SIZE 100000000
int main(){
     int n ;
     cin>>n;
     if(n==1) cout<<-1<<endl;
     vector<int>V;
     for(int i=0;i<n;i++){
         V.push_back(i+1);
     }
     for(int i=0;i<n-1;i++){
         swap(V[i],V[i+1]);
     }
     for(int i=0;i<n;i++){
         cout<<V[i]<<" ";
     }
}


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

int main() {

  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif
  int n;
  cin >> n;
  int arr[n+1];
  for( int i=1 ; i<=n ; i++){
    arr[i] = i ;
  }
  if ( n % 2 != 0 ) cout<<-1<<endl;
  else{
    for( int i=1 ; i<=n ; i++){
      swap(arr[i] , arr[i+1]);
      i++;
    }
    for( int i=1 ; i<=n ; i++){
      cout<<arr[i]<<" ";
    }
  }

}


/*
	written by pankaj kumar.
*/
#include<iostream>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#include<string.h>
using namespace std;
typedef long long ll ;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vpl;
typedef vector<string> vs;
typedef set<string> ss;
typedef set<int> si;
typedef set<ll> sl;
typedef set<pair<int,int>> spi;
typedef set<pair<ll,ll>> spl;
// macros
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define mod 1000000007;
#define phi 1.618
#define line cout<<endl;
/* ascii value
A=65,Z=90,a=97,z=122
*/

int main()
{
	pan;
	int n;
	cin>>n;
	if(n%2!=0)
		cout<<-1<<endl;
	else
	{
		for(int i=n;i>=1;i--)
		{
			cout<<i<<" ";
		}
	}
	line;
}


/*
	written by pankaj kumar.
*/
#include<iostream>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#include<string.h>
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define mod 1000000007;
using namespace std;
typedef long long ll ;
#define line cout<<endl;
/* ascii value
A=65,Z=90,a=97,z=122
*/

int main()
{
	pan;
	int n;
	cin>>n;
	if(n==1)
		cout<<-1<<endl;
	else
	{
		for(int i=n;i>=1;i--)
		{
			cout<<i<<" ";
		}
	}
	line;
}


/*
	written by pankaj kumar.
*/
#include<iostream>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#include<string.h>
using namespace std;
typedef long long ll ;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vpl;
typedef vector<string> vs;
typedef set<string> ss;
typedef set<int> si;
typedef set<ll> sl;
typedef set<pair<int,int>> spi;
typedef set<pair<ll,ll>> spl;
// macros
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define mod 1000000007;
#define phi 1.618
#define line cout<<endl;
/* ascii value
A=65,Z=90,a=97,z=122
*/

int main()
{
	pan;
	int n;
	cin>>n;
	if(n==1)
		cout<<-1<<endl;
	else
	{
		for(int i=1;i<=n;i++)
			cout<<i<<" ";
	}
	line;
}


/*
	written by pankaj kumar.
*/
#include<iostream>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#include<string.h>
using namespace std;
typedef long long ll ;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vpl;
typedef vector<string> vs;
typedef set<string> ss;
typedef set<int> si;
typedef set<ll> sl;
typedef set<pair<int,int>> spi;
typedef set<pair<ll,ll>> spl;
// macros
#define pan cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define mod 1000000007;
#define phi 1.618
#define line cout<<endl;
/* ascii value
A=65,Z=90,a=97,z=122
*/

int main()
{
	pan;
	int n;
	cin>>n;
	if(n==1)
		cout<<-1<<endl;
	else
	{
		for(int i=n;i>=1;i--)
		{
			cout<<i<<" ";
		}
	}
	line;
}


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

#define ebar_khela_hoppe int main (void)
#define bair_ho return 0
#define sf scanf
#define pf printf
#define ssf sscanf
#define spf sprintf
#define fsf fscanf
#define fpf fprintf
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define scase sf ("%d",&tc)
#define sn sf ("%d",&n)
#define whilecase while (tc--)
#define eof while (cin >> n)
#define forloop for (pos=1; pos<=tc; pos++)
#define arrayloop (i=0; i<n; i++)
#define cinstr cin >> str
#define getstr getline (cin,str)
#define pcase pf ("Case %d: ",pos)
#define vi vector <int>
#define pii pair <int,int>
#define mii map <int,int>
#define pb push_back
#define in insert
#define llu unsigned long long
#define lld long long
#define U unsigned int
#define endl "\n"

const int MOD = 1000000007;
const int MAX = 1000005;

int SetBit (int n, int x) { return n | (1 << x); }
int ClearBit (int n, int x) { return n & ~(1 << x); }
int ToggleBit (int n, int x) { return n ^ (1 << x); }
bool CheckBit (int n, int x) { return (bool)(n & (1 << x)); }

ebar_khela_hoppe
{
    /*
      freopen ("input.txt","r",stdin);
      freopen ("output.txt","w",stdout);
    */

    int n,i;

    sf ("%d",&n);

    if (n & 1)
        pf ("-1\n");
    else
    {
        for (i=n; i>=1; i--)
        {
            pf ("%d",i);

            if (i == 1)
                pf ("\n");
            else
                pf (" ");
        }
    }

    bair_ho;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <string>

using namespace std;

bool isPerfect(int* p, int n){
  // check if pi != i
  for(int i=1; i<=n; i++){
    if(p[i] == i)
      return false;
  }
  // check ppi = i
  for(int i=1; i<=n; i++){
    if(p[p[i]] != i)
      return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;

  int p[n+1] = {0};
  // fill the array
  for(int i=1; i<=n; i++){
    p[i] = i;
  }

  do {
    if(isPerfect(p, n)){
      for(int i=1; i<=n; i++)
        cout << p[i] << " ";
      return 0;
    }
  } while ( std::next_permutation(p+1,p+n+1) );
  cout << -1;
  return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <string>

using namespace std;

bool isPerfect(int* p, int n){
  // check if pi != i
  for(int i=1; i<=n; i++){
    if(p[i] == i)
      return false;
  }
  // check ppi = i
  for(int i=1; i<=n; i++){
    if(p[p[i]] != i)
      return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;

  int p[n+1] = {0};
  // fill the array
  for(int i=1; i<=n; i++){
    cin >> p[i];
  }
  do {
    if(isPerfect(p, n)){
      for(int i=1; i<=n; i++)
        cout << p[i] << " ";
      return 0;
    }
  } while ( std::next_permutation(p,p+n) );
  cout << -1;
  return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <string>

using namespace std;

bool isPerfect(int* p, int n){
  // check if pi != i
  for(int i=1; i<=n; i++){
    if(p[i] == i)
      return false;
  }
  // check ppi = i
  for(int i=1; i<=n; i++){
    if(p[p[i]] != i)
      return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;

  int p[n+1] = {0}
  // fill the array
  for(int i=1; i<=n; i++){
    cin >> p[i];
  }
  do {
    if(isPerfect(p, n)){
      for(int i=1; i<=n; i++)
        cout << p[i] << " ";
      return 0;
    }
  } while ( std::next_permutation(p,p+n) );
  cout << -1;
  return 0;
}


#include <bits/stdc++.h>
#include <algorithm>
#include <string>

using namespace std;

bool isPerfect(int* p, int n){
  // check if pi != i
  for(int i=1; i<=n; i++){
    if(p[i] == i)
      return false;
  }
  // check ppi = i
  for(int i=1; i<=n; i++){
    if(p[p[i]] != i)
      return false;
  }
  return true;
}

int main() {
  int n;
  cin >> n;

  int p[n+1] = {0};
  // fill the array
  for(int i=1; i<=n; i++){
    p[i] = i;
  }

  do {
    if (n<20){
      if(isPerfect(p, n)){
        for(int i=1; i<=n; i++)
          cout << p[i] << " ";
        return 0;
      }
    }
  } while ( std::next_permutation(p+1,p+n+1) );
  cout << -1;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    if(n%2) cout<<-1;
    else
    {
        for(int i=0;i<n/2;i++)
        {
             cout<<i+2<<" "<<i+1;
        }
    }return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    if(n==1) cout<<-1;
    else {for(int i=1;i<n;i++) cout<<i+1<<" ";cout<<1;}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    if(n%2) cout<<-1;
    else for(int i=n;i>=1;i++) cout<<i;return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    if(n%2) cout<<-1;
    else for(int i=n;i>=1;i--) cout<<i;return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;cin>>n;
    if(n%2) cout<<-1;
    else
    {
        for(int i=0;i<n/2;i++)
        {
             cout<<2*i+2<<" "<<2*i+1<<" ";
        }
    }return 0;
}


#include<bits/stdc++.h>
typedef long long int LL;
using namespace std;
#include<queue>
const int N = 2e2 + 5,  OO = 0x3f3f3f3f;
//const int negOO=-1e18;
//int sum;
//LL gcd(LL a,LL b){
//return b? gcd(b,a%b):a;
//}
int x,a[N];

int main(){
scanf("%d",&x);
    if(x==1)printf("-1");

    else{
        for(int i=0;i<x;++i){
            a[i]=i;
        }
        for(int i=0;i<x;i+=2){
            swap(a[i+1],a[i]);
        }
        for(int i=0;i<x;++i){
            if(a[i]==i){printf("-1");
                return 0;}
        }
        for(int i=0;i<x;++i){
            printf("%d ",a[i]+1);
        }
    }
return 0;
}


#include<bits/stdc++.h>
typedef long long int LL;
using namespace std;
#include<queue>
const int N = 2e2 + 5,  OO = 0x3f3f3f3f;
//const int negOO=-1e18;
//int sum;
//LL gcd(LL a,LL b){
//return b? gcd(b,a%b):a;
//}
int x,a[N];

int main(){
scanf("%d",&x);
    if(x==1)printf("-1");

    else{
        for(int i=0;i<x;++i){
            a[i]=i;
        }
        if(x%2!=0){printf("-1");
                return 0;}
        for(int i=0;i<x;i+=2){
            swap(a[i+1],a[i]);
        }

        for(int i=0;i<x;++i){
            printf("%d ",a[i]+1);
        }
    }
return 0;
}


#include<bits/stdc++.h>
typedef long long int LL;
using namespace std;
#include<queue>
const int N = 2e2 + 5,  OO = 0x3f3f3f3f;
//const int negOO=-1e18;
//int sum;
//LL gcd(LL a,LL b){
//return b? gcd(b,a%b):a;
//}
int x,a[N];

int main(){
scanf("%d",&x);
    if(x==1)printf("-1");

    else{
            a[0]=0;
        for(int i=1;i<x;++i){
            a[i]=i;
            swap(a[i-1],a[i]);
        }
    for(int i=0;i<x;++i){
        printf("%d ",a[i]+1);
    }
    }
return 0;
}


#include<bits/stdc++.h>
typedef long long int LL;
using namespace std;
#include<queue>
const int N = 2e2 + 5,  OO = 0x3f3f3f3f;
//const int negOO=-1e18;
//int sum;
//LL gcd(LL a,LL b){
//return b? gcd(b,a%b):a;
//}
int x,a[N];

int main(){
scanf("%d",&x);
    if(x==1)scanf("-1");
    else{
            a[0]=0;
        for(int i=1;i<x;++i){
            a[i]=i;
            swap(a[i-1],a[i]);
        }
    }
    for(int i=0;i<x;++i){
        printf("%d ",a[i]+1);
    }
return 0;
}


#include<bits/stdc++.h>
typedef long long int LL;
using namespace std;
#include<queue>
const int N = 2e2 + 5,  OO = 0x3f3f3f3f;
//const int negOO=-1e18;
//int sum;
//LL gcd(LL a,LL b){
//return b? gcd(b,a%b):a;
//}
int x,a[N];

int main(){
scanf("%d",&x);
    if(x==1)printf("-1");

    else{
        for(int i=0;i<x;++i){
            a[i]=i;
        }
        for(int i=0;i<x;i+=2){
            swap(a[i+1],a[i]);
        }
        if(x%2!=0){printf("-1");
                return 0;}
        }
        for(int i=0;i<x;++i){
            printf("%d ",a[i]+1);
        }
    }
return 0;
}


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

int main()
{
    int n;
    cin>>n;

    if(n%2 != 0)
        cout<<"-1\n";
    else
    {
        for(int i=1; i<=n; i++)
        {
            if(i % 2 == 0)
                cout<<i-1<<' ';
            else
                cout<<i+1<<' ';
        }
    }
    cout<<'\n';
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    if(n == 1)
        cout<<-1<<'\n';
    else{
    for(int i=n; i>0 ; i--)
        cout<<i<<' ';
    cout<<'\n';}
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    if(n == 1)
        cout<<-1<<'\n';

    for(int i=n; i>0 ; i--)
        cout<<i;
    cout<<'\n';
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    if(n == 1)
        cout<<-1<<'\n';
    else if(n == 3)
    {
        cout<<"3 1 2\n";
    }
    else{
    for(int i=n; i>0 ; i--)
        cout<<i<<' ';
    cout<<'\n';}
    return 0;
}


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

int main()
{
    int n;
    cin>>n;
    if(n == 1)
        cout<<-1<<'\n';
    else{
    for(int i=n; i>0 ; i--)
        cout<<i;
    cout<<'\n';}
    return 0;
}


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

int main(){
    int arr[100],n;
    cin >> n;
    if (n > 1) {
        for (int i = 1; i<=n; i+=2){
            arr[i] = i+1;
            arr[i+1] = i;
        }
        for (int i = 0; i<n; i++){
            cout << arr[i] << ' ';
        }
    } else {
        cout << -1;
    }
}


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

int main(){
    int arr[100],n;
    cin >> n;
    if (n > 1 && n%2 == 0) {
        for (int i = 1; i<=n; i+=2){
            arr[i-1] = i+1;
            arr[i] = i;
        }
        for (int i = 0; i<n; i++){
            cout << arr[i] << ' ';
        }
    } else {
        cout << -1;
    }
}


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

int main(){
    int arr[100],n;
    cin >> n;
    if (n > 1) {
        for (int i = 1; i<=n; i+=2){
            arr[i-1] = i+1;
            arr[i] = i;
        }
        for (int i = 0; i<n; i++){
            cout << arr[i] << ' ';
        }
    } else {
        cout << -1;
    }
}


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

int main(){
    int arr[100],n;
    cin >> n;
    for (int i = 1; i<=n; i+=2){
        arr[i] = i+1;
        arr[i+1] = i;
    }
    for (int i = 0; i<n; i++){
        cout << arr[i] << ' ';
    }
}


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

int main(){
    int arr[100],n;
    cin >> n;
    if (n > 1) {
        for (int i = 1; i<=n; i+=2){
            arr[i] = i+1;
            arr[i+1] = i;
        }
        for (int i = 0; i<n; i++){
            cout << arr[i] << ' ';
        }
    } else {
        cout << 0;
    }
}


#include<bits/stdc++.h>
#define Yes cout<<"YES"<<endl;
#define No cout<<"NO"<<endl;
#define ll long long int
using namespace std;
int main()
{
    int n,e,f,g,x,y,z=0,cnt=0,sum=0;
    string str;
    cin>>n;
    if(n%2==1) {cout<<"-1";}
    else {
    for(int i=2; i<=n; i+=2)
    {
        if(i>=2)
        {
            cout<<i<<" "<<i-1<<" ";
        }
    }}

}


#include<bits/stdc++.h>
#define Yes cout<<"YES"<<endl;
#define No cout<<"NO"<<endl;
#define ll long long int
using namespace std;
int main()
{
    int n,e,f,g,x,y,z=0,cnt=0,sum=0;
    string str;
    cin>>n;
    if(n==1) cout<<"-1"<<endl;
    for(int i=2; i<=n; i+=2)
    {
        if(i>=2)
        {
            cout<<i<<" "<<i-1<<" ";
        }
    }

}


#include<bits/stdc++.h>
#define Yes cout<<"YES"<<endl;
#define No cout<<"NO"<<endl;
#define ll long long int
using namespace std;
int main()
{
    int n,e,f,g,x,y,z=0,cnt=0,sum=0;
    string str;
    cin>>n;
    if(n%2==1) cout<<"-1"<<endl;break;
    for(int i=2; i<=n; i+=2)
    {
        if(i>=2)
        {
            cout<<i<<" "<<i-1<<" ";
        }
    }

}


#include<bits/stdc++.h>
#define Yes cout<<"YES"<<endl;
#define No cout<<"NO"<<endl;
#define ll long long int
using namespace std;
int main()
{
    int n,e,f,g,x,y,z=0,cnt=0,sum=0;
    string str;
    cin>>n;
    if(n%2==1) cout<<"-1"<<endl;
    for(int i=2; i<=n; i+=2)
    {
        if(i>=2)
        {
            cout<<i<<" "<<i-1<<" ";
        }
    }

}


#include<bits/stdc++.h>
#define Yes cout<<"YES"<<endl;
#define No cout<<"NO"<<endl;
#define ll long long int
using namespace std;
int main()
{
    int n,e,f,g,x,y,z=0,cnt=0,sum=0;
    string str;
    cin>>n;
    if(n%2==1) {cout<<"-1"<<endl;break;}
    for(int i=2; i<=n; i+=2)
    {
        if(i>=2)
        {
            cout<<i<<" "<<i-1<<" ";
        }
    }

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std ;
int main() {
    int n ;
    cin >> n ;
    if(n == 1 )
      cout << "-1"  ;
    else if ( n%2 != 0 )
       cout << " -1 "  ;
    else
        for(int i = 2 ; i <= n ; i=i+2) {
            cout << i<<" " <<   i - 1<<" "   ;
        }

   }


#include <iostream>
#include <bits/stdc++.h>
using namespace std ;
int main() {
    int n ;
    cin >> n ;
    if(n == 1 )
      cout << "-1"  ;
    else if ( n%2 != 0 )
       cout << " -1 "  ;
    else
        for(int i = 2 ; i <= n ; i=i+2) {
            cout << i   <<   i - 1   ;
        }

   }


#include <iostream>
#include <bits/stdc++.h>
using namespace std ;
int main() {
    int n ;
    cin >> n ;
    if(n == 1 )
      cout << "-1"  ;
    else if ( n%2 == 0 )
       cout << " -1 "  ;
    else
        for(int i = 2 ; i <= n ; i=i+2) {
            cout << i <<  << i - 1 <<  ;
        }

   }


#include <iostream>
#include <bits/stdc++.h>
using namespace std ;
int main() {
    int n ;
    cin >> n ;
    if(n == 1 )
      cout << "-1"  ;
    else if ( n%2 != 0 )
       cout << " -1 "  ;
    else
        for(int i = 2 ; i <= n ; i=i+2) {
            cout << i <<   i - 1   ;
        }

   }


#include <iostream>
#include <bits/stdc++.h>
using namespace std ;
int main() {
    int n ;
    cin >> n ;
    if(n == 1 )
      cout << "-1"  ;
    else if ( n%2 != 0 )
       cout << " -1 "  ;
    else
        for(int i = 2 ; i <= n ; i=i+2) {
            cout << i <<  << i - 1 <<  ;
        }

   }


#include <iostream>
#include <bits/stdc++.h>
using namespace std ;
int main() {
    int n ;
    cin >> n ;
    if(n == 1 )
      cout << "-1"  ;
    else if ( n%2 == 0 )
       cout << " -1 "  ;
    else
        for(int i = 2 ; i <= n ; i=i+2) {
            cout << i  << i - 1  ;
        }

   }


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define getl(s) getline(cin,s)
#define sort(s) sort(s.begin(),s.end())
#define all(x) x.begin(),x.end()
int main(int argc, char const *argv[])
{
	ll n,x;
	cin >> n;
	if(n==1)
	{
		cout<<-1<<endl;
		return 0;
	}
	vector<ll>v;
	for(ll i=1;i<=n;i++) v.pb(i);
	swap(v[n-1],v[n-2]);
	if(n>2)
	swap(v[0],v[1]);
	for(ll i=0;i<n;i++)
		cout<<v[i]<<" ";

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define getl(s) getline(cin,s)
#define sort(s) sort(s.begin(),s.end())
#define all(x) x.begin(),x.end()
int main(int argc, char const *argv[])
{
	ll n,x;
	cin >> n;
	if(n%2)
	{
		cout<<-1<<endl;
		return 0;
	}
	vector<ll>v;
	for(ll i=1;i<=n;i++) v.pb(i);
	for(ll i=0;i<n;i+=2) swap(v[i],v[i+1]);
	for(ll i=0;i<n;i++) cout<<v[i]<<" ";

	return 0;


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define getl(s) getline(cin,s)
#define sort(s) sort(s.begin(),s.end())
#define all(x) x.begin(),x.end()
int main(int argc, char const *argv[])
{
	ll n;
	cin >> n;
	if(n==1)
	{
		cout<<-1<<endl;
		return 0;
	}
	vector<ll>v;
	while(n--)
	{
		cin>>x;
		v.pb(x);
	}
	swap(v[n-1],v[n-2]);
	for(ll i=0;i<n;i++)
		cout<<v[i]<<" ";

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define getl(s) getline(cin,s)
#define sort(s) sort(s.begin(),s.end())
#define all(x) x.begin(),x.end()
int main(int argc, char const *argv[])
{
	ll n,x;
	cin >> n;
	if(n==1)
	{
		cout<<-1<<endl;
		return 0;
	}
	vector<ll>v;
	for(ll i=1;i<=n;i++) v.pb(i);
	swap(v[n-1],v[n-2]);
	for(ll i=0;i<n;i++)
		cout<<v[i]<<" ";

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define getl(s) getline(cin,s)
#define sort(s) sort(s.begin(),s.end())
#define all(x) x.begin(),x.end()
int main(int argc, char const *argv[])
{
	ll n,x;
	cin >> n;
	if(n==1)
	{
		cout<<-1<<endl;
		return 0;
	}
	vector<ll>v;
	while(n--)
	{
		cin>>x;
		v.pb(x);
	}
	swap(v[n-1],v[n-2]);
	for(ll i=0;i<n;i++)
		cout<<v[i]<<" ";

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define getl(s) getline(cin,s)
#define sort(s) sort(s.begin(),s.end())
#define all(x) x.begin(),x.end()
int main(int argc, char const *argv[])
{
	ll n,x;
	cin >> n;
	if(n%2)
	{
		cout<<-1<<endl;
		return 0;
	}
	vector<ll>v;
	for(ll i=1;i<=n;i++) v.pb(i);
	for(ll i=0;i<n;i+=2) swap(v[i],v[i+1]);
	for(ll i=0;i<n;i++) cout<<v[i]<<" ";

	return 0;
}


#include<iostream>
using namespace std;
int n;
int main(){
    cin >> n;
    if(n==1)
        cout << -1;
    else
    for(int i=0; i<n-1; i++){
        cout << i+1;
    }
    cout << 1;
}


#include <iostream>using namespace std;int n;int main(){scanf("%d", &n);if(n&1)printf("-1");else  for(int i=1;i<=n;i++ )printf("%d ",(i%2)?i+1:i-1);}


#include<iostream>
using namespace std;
int n;
int main(){
    cin >> n;
    if(n==1)
        cout << -1;
    else{
    for(int i=0; i<n-1; i++)
        cout << i+1;
    cout << 1;
    }
}


#include <cstdio>
#include <queue>
#include <vector>
#include<iostream>
#include<map>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<bits/stdc++.h>

#define rep(i,a,b)  for(int i = a; i <= b; i++)
#define ll long long
#define inf 1e15
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define PI acos(-1)
#define fi first
#define se second
#define pb push_back

using namespace std;

const int N=1e6+10;
const ll mod=1e9+7;

inline ll read()
{
    ll X=0; bool flag=1; char ch=getchar();
    while(ch<'0'||ch>'9') {if(ch=='-') flag=0; ch=getchar();}
    while(ch>='0'&&ch<='9') {X=(X<<1)+(X<<3)+ch-'0'; ch=getchar();}
    if(flag) return X;
    return ~(X-1);
}

ll n,m,k;
ll ans;
ll ar[N],br[N];
char ch[N];
ll gcd(ll a,ll b)
{
    if(a%b==0) return b;
    return gcd(a%b,a);
}
int main()
{
    // gbtb;
    // freopen("input.txt","r",stdin);

    //while(~scanf("%d %d",&x,&y))

     // int T;T=read();while(T--)
    {
        n=read(); m=read();  ll g;
        rep(i,1,n)
        {
            ar[i]=read(); if(i==1) continue; if(i==2) g=ar[i]-ar[i-1]; else g=gcd(g,ar[i]-ar[i-1]);
        }
        ans=-1;
       // printf("g=%d\n",g);
        rep(i,1,m)
        {
            ll t=read();
            if(g%t==0) ans=i;
        }
        //printf("ans=%d\n",ans);
        if(ans==-1) printf("NO\n");
        else {printf("YES\n");printf("%lld %lld\n",ar[1],ans);}

    }
    return 0;

}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long a[300005];
long long p[300005];
long long c[300005];

long long gcd(long long a, long long b)
{
	return b?gcd(b, a%b) :a;
}

int main()
{
	long long n, m, ans;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		scanf("%ld", &a[i]);
	for(int i = 1; i < n; i++)
	{
		c[i] = a[i] - a[i-1];
	}
	ans = c[1];
	for(int i = 2; i < n; i++)
		ans = gcd(ans , c[i]);
	for(int i = 1; i <= m; ++i)
    {
        scanf("%I64d", &p[i]);
    }
	ll y, pos;
    bool flag = false;
    for(int i = 1; i <= m; ++i)
    {
        if(ans % p[i] == 0)
        {
            pos = i;
            flag = true;
            break;
        }
    }
    if(flag)
    {
        printf("YES\n");
        printf("%I64d %I64d\n", a[0], pos);
    }
    else
        printf("NO\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long a[300005];
long long b[300005];
long long d[300005];
using namespace std;

long long gcd(long long a, long long b)
{
	return b?gcd(b, a%b) :a;
}

int main()
{
	int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; ++i)
    {
        scanf("%I64d", &a[i]);
    }
    for(int i = 2; i <= n; ++i)
    {
        d[i] = a[i] - a[i - 1];
    }
    ll ans = gcd(d[2], d[3]);
    for(int i = 4; i <= n; ++i)
    {
        ans = gcd(ans, d[i]);
    }
	bool flag = 1;
	for(int i = 0; i < m; i++)
		scanf("%ld", &b[i]);
	for(int i = 0; i < m; i++)
	{
		if(ans % b[i] == 0)
		{
			cout << "YES" << endl << a[1] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
long long a[300005];
long long b[300005];
using namespace std;

long long gcd(long long a, long long b)
{
	if(b == 0)
		return a;
	else return gcd(b, a%b);
}

int main()
{
	long long n, m, c, d;
	cin >> n >> m;
	scanf("%d", &a[0]);
	for(int i = 1; i < n; i++)
	{
		scanf("%d", &a[i]);
		if(i == 1)
			c = a[i]-a[i-1];
		else
		{
			d = a[i]-a[i-1];
			c = gcd(c, d);
		}
	}
	bool flag = 1;
	for(int i = 0; i < m; i++)
	{
		scanf("%d", &b[i]);
		if(c % b[i] == 0)
		{
			cout << "YES" << endl << a[0] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
long long a[300005];
long long b[300005];
using namespace std;

long long gcd(long long a, long long b)
{
	return b?gcd(b, a%b) :a;
}

int main()
{
	long long n, m, c, d;
	cin >> n >> m;
	scanf("%ld", &a[0]);
	for(int i = 1; i < n; i++)
	{
		scanf("%ld", &a[i]);
		if(i == 1)
			c = a[i]-a[i-1];
		else
		{
			d = a[i]-a[i-1];
			c = gcd(c, d);
		}
	}
	bool flag = 1;
	for(int i = 0; i < m; i++)
		scanf("%d", &b[i]);
	for(int i = 0; i < m; i++)
	{
		if(c % b[i] == 0)
		{
			cout << "YES" << endl << a[0] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
int a[300005];
int b[300005];
using namespace std;

int gcd(int a, int b)
{
	if(b == 0)
		return a;
	else return gcd(b, a%b);
}

int main()
{
	int n, m, c, d;
	cin >> n >> m;
	scanf("%d", &a[0]);
	for(int i = 1; i < n; i++)
	{
		scanf("%d", &a[i]);
		if(i == 1)
			c = a[i]-a[i-1];
		else
		{
			d = a[i]-a[i-1];
			c = gcd(c, d);
		}
	}
	bool flag = 1;
	for(int i = 0; i < m; i++)
	{
		scanf("%d", &b[i]);
		if(c % b[i] == 0)
		{
			cout << "Yes" << endl << a[0] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
long long a[300005];
long long b[300005];
long long c[300005];
using namespace std;

long long gcd(long long a, long long b)
{
	return b?gcd(b, a%b) :a;
}

int main()
{
	long long n, m, d;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 1; i < n; i++)
	{
		c[i] = a[i] - a[i-1];
	}
	d = gcd(c[1] , c[2]);
	for(int i = 3; i < n; i++)
		d = gcd(d , c[i]);
	bool flag = 1;
	for(int i = 0; i < m; i++)
		cin >> b[i];
	for(int i = 0; i < m; i++)
	{
		if(d % b[i] == 0)
		{
			cout << "YES" << endl << a[0] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int a[10], book[10], n;

void dfs(int step)
{
	int i;
	if(step == n+1)
	{
		for(i = 1; i <= n; i++)
			printf("%d", a[i]);
		printf("\n");
		return;
	}
	for(int i = 1; i <= n; i++)
	{
		if(book[i] == 0)
		{
			a[step] = i;
			book[i] = 1;
			dfs(step + 1);
			book[i] = 0;
		}
	}
	return;
}

int main()
{
    n = 9;
    dfs(1);
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
long long a[300005];
long long b[300005];
long long c[300005];
using namespace std;

long long gcd(long long a, long long b)
{
	return b?gcd(b, a%b) :a;
}

int main()
{
	long long n, m, d;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		scanf("%ld", &a[i]);
	for(int i = 1; i < n; i++)
	{
		c[i] = a[i] - a[i-1];
	}
	d = gcd(c[1] , c[2]);
	for(int i = 3; i < n; i++)
		d = gcd(d , c[i]);
	bool flag = 1;
	for(int i = 0; i < m; i++)
		scanf("%ld", &b[i]);
	for(int i = 0; i < m; i++)
	{
		if(d % b[i] == 0)
		{
			cout << "YES" << endl << a[0] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define lson l, mid, rt << 1
#define rson mid + 1, r, rt << 1|1
const int inf = 0x3f3f3f3f;
const int maxn = 3e5 + 10;
ll a[maxn], p[maxn];
ll d[maxn];
ll gcd(ll x, ll y)
{
    return y == 0 ? x : gcd(y, x % y);
}
int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; ++i)
    {
        scanf("%I64d", &a[i]);
    }
    for(int i = 2; i <= n; ++i)
    {
        d[i] = a[i] - a[i - 1];
    }
    ll ans = gcd(d[2], d[3]);
    for(int i = 4; i <= n; ++i)
    {
        ans = gcd(ans, d[i]);
    }
    for(int i = 1; i <= m; ++i)
    {
        scanf("%I64d", &p[i]);
    }
    ll y, pos;
    bool flag = false;
    for(int i = 1; i <= m; ++i)
    {
        if(ans % p[i] == 0)
        {
            pos = i;
            flag = true;
            break;
        }
    }
    if(flag)
    {
        printf("YES\n");
        printf("%I64d %I64d\n", a[1], pos);
    }
    else
        printf("NO\n");
    return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
long long a[300005];
long long b[300005];
long long c[300005];
using namespace std;

long long gcd(long long a, long long b)
{
	return b?gcd(b, a%b) :a;
}

int main()
{
	long long n, m, d;
	cin >> n >> m;
	for(int i = 0; i < n; i++)
		scanf("%ld", &a[i]);
	for(int i = 1; i < n; i++)
	{
		c[i] = a[i] - a[i-1];
	}
	d = c[1];
	for(int i = 2; i < n; i++)
		d = gcd(d , c[i]);
	bool flag = 1;
	for(int i = 0; i < m; i++)
		scanf("%ld", &b[i]);
	for(int i = 0; i < m; i++)
	{
		if(d % b[i] == 0)
		{
			cout << "YES" << endl << a[0] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
long long a[300005];
long long b[300005];
using namespace std;

long long gcd(long long a, long long b)
{
	return b?gcd(b, a%b) :a;
}

int main()
{
	long long n, m, c, d;
	cin >> n >> m;
	scanf("%d", &a[0]);
	for(int i = 1; i < n; i++)
	{
		scanf("%d", &a[i]);
		if(i == 1)
			c = a[i]-a[i-1];
		else
		{
			d = a[i]-a[i-1];
			c = gcd(c, d);
		}
	}
	bool flag = 1;
	for(int i = 0; i < m; i++)
	{
		scanf("%d", &b[i]);
		if(c % b[i] == 0)
		{
			cout << "YES" << endl << a[0] <<" "<< i+1;
			flag = 0;
			break;
		}
	}
	if(flag)
	cout << "NO";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m;
long long x[300005], p[300005];

int main(){

    cin >> n >> m;
    for ( int i=0; i<n; i++ ) {
        cin >> x[i];
    }
    for ( int i=0; i<m; i++ ) {
        cin >> p[i];
    }
    long long g = x[1]-x[0];
    for ( int i=2; i<n; i++ ) {
        g = min(g, __gcd(x[i] - x[i-1], g) );
    }
    long long sol = -1;
    for ( int i=0; i<m; i++ ) {
        if ( p[i] == g || p[i] == 1 ) {
            sol = i+1;
            break;
        }
    }
    if ( sol != -1 ) {
        cout << "YES" << endl;
        cout << x[0] << " " << sol;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m;
long long x[300005], p[300005];

int main(){

    cin >> n >> m;
    for ( int i=0; i<n; i++ ) {
        cin >> x[i];
    }
    for ( int i=0; i<m; i++ ) {
        cin >> p[i];
    }
    long long g = x[1]-x[0];
    for ( int i=2; i<n; i++ ) {
        g = min(g, __gcd(x[i] - x[i-1], g) );
    }
    long long sol = -1;
    for ( int i=0; i<m; i++ ) {
        if ( p[i] == g ) {
            sol = i+1;
            break;
        }
    }
    if ( sol != -1 ) {
        cout << "YES" << endl;
        cout << x[0] << " " << sol;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m;
long long x[300005], p[300005];

int main(){

    cin >> n >> m;
    for ( int i=0; i<n; i++ ) {
        cin >> x[i];
    }
    for ( int i=0; i<m; i++ ) {
        cin >> p[i];
    }
    sort(x, x+n);
    long long g = x[1]-x[0];
    for ( int i=2; i<n; i++ ) {
        g = min(g, __gcd(x[i] - x[i-1], g) );
    }
    long long sol = -1;
    for ( int i=0; i<m; i++ ) {
        if ( g % p[i] == 0 ) {
            sol = i+1;
            break;
        }
    }
    if ( sol != -1 ) {
        cout << "YES" << endl;
        cout << x[0] << " " << sol;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m;
long long x[300005], p[300005];

int main(){

    cin >> n >> m;
    for ( int i=0; i<n; i++ ) {
        cin >> x[i];
    }
    for ( int i=0; i<m; i++ ) {
        cin >> p[i];
    }
    long long g = x[0];
    for ( int i=1; i<n; i++ ) {
        g = min(g, __gcd(x[i], g) );
    }
    int sol = -1;
    for ( int i=0; i<m; i++ ) {
        if ( p[i] == g ) {
            sol = i+1;
            break;
        }
    }
    if ( sol != -1 ) {
        cout << "YES" << endl;
        cout << g << " " << sol;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m;
long long x[300005], p[300005];

int main(){

    cin >> n >> m;
    for ( int i=0; i<n; i++ ) {
        cin >> x[i];
    }
    for ( int i=0; i<m; i++ ) {
        cin >> p[i];
    }
    sort(x, x+n);
    long long g = x[1]-x[0];
    for ( int i=2; i<n; i++ ) {
        g = min(g, __gcd(x[i] - x[i-1], g) );
    }
    long long sol = -1;
    for ( int i=0; i<m; i++ ) {
        if ( p[i] == g || p[i] == 1 ) {
            sol = i+1;
            break;
        }
    }
    if ( sol != -1 ) {
        cout << "YES" << endl;
        cout << x[0] << " " << sol;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n, m;
long long x[300005], p[300005];

int main(){

    cin >> n >> m;
    for ( int i=0; i<n; i++ ) {
        cin >> x[i];
    }
    for ( int i=0; i<m; i++ ) {
        cin >> p[i];
    }
    long long g = x[0];
    for ( int i=1; i<n; i++ ) {
        g = min(g, __gcd(x[i], g) );
    }
    long long sol = -1;
    for ( int i=0; i<m; i++ ) {
        if ( p[i] == g ) {
            sol = i+1;
            break;
        }
    }
    if ( sol != -1 ) {
        cout << "YES" << endl;
        cout << g << " " << sol;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
//	if (res != 1) {
//		for (int i = 3; i <= n; i++) {
//			ori = lat;
//			scanf("%I64d", &lat);
//			if (lat - ori == 1) {
//				res = 1;
//				break;
//			}
//			res = gcd(res, lat - ori);
//			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
//				break;
//			}
//		}
//	}
	for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
//			if (lat - ori == 1) {
//				res = 1;
//				break;
//			}
			res = gcd(res, lat - ori);
//			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
//				break;
//			}
		}
	ll inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO";
	return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
//	if (res != 1) {
//		for (int i = 3; i <= n; i++) {
//			ori = lat;
//			scanf("%I64d", &lat);
//			if (lat - ori == 1) {
//				res = 1;
//				break;
//			}
//			res = gcd(res, lat - ori);
//			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
//				break;
//			}
//		}
//	}
	for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
			if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
				break;
			}
		}
	ll inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO";
	return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) {
	return a == 0 ? b : gcd(b%a, a);
}
int main() {
	int n, m; cin >> n >> m;
	ll ori, lat; scanf("%I64d %I64d", &ori, &lat);
	ll res = lat - ori;
	ll sto = ori;
	if (res != 1) {
		for (int i = 3; i <= n; i++) {
			ori = lat;
			scanf("%I64d", &lat);
			if (lat - ori == 1) {
				res = 1;
				break;
			}
			res = gcd(res, lat - ori);
			//if (res == 1) { // gcd����û��1���������1������������  !!����ҲҪ��
			//	break; //��仰����
			//}
		}
	}
	int inp;
	for (int i = 1; i <= m; i++) {
		scanf("%I64d", &inp);
		if (res%inp == 0) {
			cout << "YES" << endl;
			printf("%I64d %d", sto, i);
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;

}