You're given a row with $$$n$$$ chairs. We call a seating of people "maximal" if the two following conditions hold:  There are no neighbors adjacent to anyone seated.  It's impossible to seat one more person without violating the first rule. The seating is given as a string consisting of zeros and ones ($$$0$$$ means that the corresponding seat is empty, $$$1$$$ — occupied). The goal is to determine whether this seating is "maximal".Note that the first and last seats are not adjacent (if $$$n \ne 2$$$).

The first line contains a single integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of chairs. The next line contains a string of $$$n$$$ characters, each of them is either zero or one, describing the seating.

Output "Yes" (without quotation marks) if the seating is "maximal". Otherwise print "No". You are allowed to print letters in whatever case you'd like (uppercase or lowercase).

NoteIn sample case one the given seating is maximal.In sample case two the person at chair three has a neighbour to the right.In sample case three it is possible to seat yet another person into chair three.

import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String bin=sc.next();
        char check=0;
        int flag=0;
        int count=0;
        for(int i=0;i<n;i++)
        {
            char dummy=bin.charAt(i);
            if(n==1 && dummy=='0')
            {
                flag=1;
            }
            else if(dummy=='0' && check==1)
            {
                check=0;
                count++;
            }
            else if(dummy=='0' && check==0)
            {
                count++;
                if(count>=3)
                {
                    flag=1;
                    break;
                }
                else if ( (count==2 ) && (i==1 || i==n-1) )
                {
                    flag=1;
                    break;
                }
            }
            else
            {
                count=0;
                check=1;
            }
            if(i!=n-1 && dummy=='1' && bin.charAt(i+1)=='1')
            {
                flag=1;
                break;
            }
        }
        if(flag==0)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }

    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
	Scanner s = new Scanner(System.in);
        int n=s.nextInt();
        String str=s.next();
        if(n==1){
            if(str.charAt(0)=='0')
            System.out.println("No");
            if(str.charAt(0)=='1')
            System.out.println("Yes");

            return;
        }

        if(str.charAt(0)==str.charAt(1))
        {
            System.out.println("No");
                        return;
        }

        if(str.charAt(n-1)=='0'&&str.charAt(n-2)=='0')
        {
            System.out.println("No");
                        return;
        }

        for(int i=0;i<n-2;i++){
        	if(str.charAt(i)=='0'&&str.charAt(i+1)=='0')
                    if(str.charAt(i+2)=='0'){
                        System.out.println("No");
                        return;
                    }
            if(str.charAt(i)=='0'&&str.charAt(i+1)=='1')
                    if(str.charAt(i+2)=='1'){
                        System.out.println("No");
                        return;
                    }
            if(str.charAt(i)=='1'&&str.charAt(i+1)=='1') {

                        System.out.println("No");
                        return;
                    }
        	}

        System.out.println("yes");

	}
}

import java.util.*;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();
		String ans = "Yes";
		if (n==1) {
			if (s.charAt(0)=='0')
				ans = "No";
			else
				ans="Yes";
		}else {
			int index =0;
			while(index<n && s.charAt(index)=='0') {
				index++;
			}

			if (index>=2)
				ans="No";
			//System.out.println(index);
			int index1 = n-1;
			while(index1>=0 && s.charAt(index1)=='0') {
				index1--;
			}

			if (n-index1-1>1) {
				ans="No";
			}

			if (!ans.equals("No")) {

				for (int i =0;i<n-1;i++) {
					if (s.charAt(i)=='1') {
						int count =0;
						int j = i+1;
						for (j=i+1;j<n;j++) {
							if (s.charAt(j)=='0')
								count++;
							else
								break;
						}
						if (count>2)
						{
							ans="No";
							break;
						}else if (count==0 && j-i==1) {
							ans="No";
						}
					}
				}

			}

		}
		System.out.println(ans);

		sc.close();

	}

}

import java.util.Scanner;
public class Codeforces {
 public static void main(String args[]) {
	 Scanner sc = new Scanner(System.in);
	 int n = sc.nextInt();
	 int ctr=0;
	 int flag=0;
	 String s = sc.next();
	 for(int i=0;i<s.length();i++)
	 {
		 if(i>0&&s.charAt(i)=='1'&&s.charAt(i-1)=='1')flag=1;
		 if(i==1&&s.charAt(i-1)=='0'&&s.charAt(i)=='0')flag=1;
		 if(i==s.length()-1&&i>0&&s.charAt(i-1)=='0'&&s.charAt(i)=='0')flag=1;
		if(i>0&&i<s.length()-1&&s.charAt(i-1)=='0'&&s.charAt(i)=='0'&&s.charAt(i+1)=='0')flag=1;

	 }
	 if(s.length()==1&&s.charAt(0)=='0')flag=1;
	 if(flag==1)
	 System.out.println("No");
	 else System.out.println("Yes");

 }
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

	int mod = 1000000007;

	static public int diff(int[] a, int i, int j) {
		return Math.abs(a[i] - a[j]);
	}

	public static String reverse(String str) {
		return new StringBuilder(str).reverse().toString();
	}

	// even-length array a, consisting of 0s and 1s.
	// remove half elements
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		out = new PrintWriter(new BufferedOutputStream(System.out));

		int n = sc.nextInt();
		String str = "0" + sc.nextLine() + "0";
		char last = str.charAt(0);
		int count = 1;

		boolean valid = true;
		for (int i = 1; i < n + 2; i++) {
			char val = str.charAt(i);
			if (val == last) {
				count++;
				if ((val == '1' && count == 2) || (val == '0' && count == 3)) {
					valid = false;
					break;
				}
			} else {
				last = val;
				count = 1;
			}
		}

		out.print(valid ? "Yes" : "No");
		out.close();
	}

	// -----------PrintWriter for faster output---------------------------------
	public static PrintWriter out;

	// -----------MyScanner class for faster input----------
	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	// --------------------------------------------------------
}

import java.io.*;
import java.util.*;
public class q2
{
  public static void main(String args[])throws IOException
  {
    //Scanner in=new Scanner(System.in);
    FastReader in=new FastReader();
    PrintWriter pw=new PrintWriter(System.out, true);
    int n=in.nextInt();
    String str=in.next();
    str="0"+str+"0";
    int count=0;
    for(int i=1;i<=n;i++)
  	{
  		if(str.charAt(i)=='1')
  		{
  			if(str.charAt(i-1)=='1' || str.charAt(i+1)=='1')
  			{
  				pw.println("No");
  				return;
  			}
  		}
  		else
  		{
  			if(str.charAt(i-1)=='0' && str.charAt(i+1)=='0')
        count++;
  		}
  	}
	   pw.println(count>0?"No":"Yes");
  }
}
class FastReader
  {
      BufferedReader br;
      StringTokenizer st;

      public FastReader()
      {
          br = new BufferedReader(new
                   InputStreamReader(System.in));
      }

      String next()
      {
          while (st == null || !st.hasMoreElements())
          {
              try
              {
                  st = new StringTokenizer(br.readLine());
              }
              catch (IOException  e)
              {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt()
      {
          return Integer.parseInt(next());
      }

      long nextLong()
      {
          return Long.parseLong(next());
      }

      double nextDouble()
      {
          return Double.parseDouble(next());
      }

      String nextLine()
      {
          String str = "";
          try
          {
              str = br.readLine();
          }
          catch (IOException e)
          {
              e.printStackTrace();
          }
          return str;
      }
  }

import java.io.*;
		import java.math.BigInteger;
		import java.math.RoundingMode;
		import java.text.DecimalFormat;
		import java.util.*;

		public class Solution
		{

			static double eps=(double)1e-6;
			static int no=(int) (1e5+1);
			static long mod=(long)(1e9+7);
			//static int arr[] =new int[1000001];
			//private static DecimalFormat df2 = new DecimalFormat(".##");
			public static void main(String args[]){
				InputReader sc = new InputReader(System.in);
				//Scanner sc=new Scanner(System.in);
				OutputStream outputStream = System.out;
				PrintWriter out = new PrintWriter(outputStream);
				//----------my code----------
				int t1=1;
				while(t1-->0)
				{
					int n=sc.nextInt();
					/*Pair intr[]=new Pair[n];
					TreeMap<Integer,Integer>extr=new TreeMap<Integer,Integer>(Collections.reverseOrder());
					for(int i=0;i<n;i++)
					{
						int temp=sc.nextInt();
						intr[i]=new Pair(temp,i+1);
					}
					Arrays.sort(intr,ORIGINAL);*/

					String s=sc.nextLine();
					/*int inti=0;

					for(int i=0;i<s.length();i++)
					{
						if(s.charAt(i)-'0'==0)
						{
							out.print(intr[inti].gety()+" ");
							extr.put((int)intr[inti].getx(),(int)intr[inti].gety());
							inti++;

						}
						else
						{
								int temp=extr.firstKey();
								out.print(extr.get(temp)+" ");
								extr.remove(temp);
						}

					}*/
					/*if(n%2==1)
					{
						int flag=0;
					for(int i=0;i<n;i++)
					{
						if(i%2==1 && s.charAt(i)-'0'!=0)
						{
							flag=1;
							break;
						}
						if(i%2==0 && s.charAt(i)-'1'!=0)
						{
							flag=1;
							break;
						}
					}
					if(flag==0)
						out.println("Yes");
					else
						out.println("No");
					}
					else
					{
						int flag=0;
						int count=0;
						for(int i=0;i<n;i++)
						{
							if(s.charAt(i)-'0'==0)
							{
									flag=1;
							}
							else
							{
								count++;
								if(flag==0 || flag==1)
								{
									flag=2;
								}
								if(flag==2)
								{
									flag=-1;
									break;
								}
							}
						}
						if(flag==-1 || count!=n/2)
							out.println("No");
						else
							out.println("Yes");
					}*/
					int temp1=0,temp2=0,flag=0;
					if(n==1)
					{
						if(s.charAt(0)-'0'==0)
							flag=1;
					}
					if(n>=2)
					{
						if(s.charAt(0)-'0'==0 && s.charAt(1)-'0'==0)
							flag=1;
						else if(s.charAt(n-2)-'0'==0 && s.charAt(n-1)-'0'==0)
							flag=1;
					}
					for(int i=0;i<n;i++)
					{
						if(s.charAt(i)-'0'==0)
						{
							if(temp1==1)
							{
								temp2++;
								if(temp2>=3)
								{
									flag=1;
									break;
								}
							}
							else
							{
								temp2++;
								temp1=1;
							}
						}
						else
						{
							if(temp1==2)
							{
								flag=1;
								break;
							}
							else
							{
								temp1=2;
								temp2=0;
							}
						}
					}
					if(flag==0)
						out.println("Yes");
					else
						out.println("No");
				}
				//---------------------------------
				out.close();
			}

			private static void ndfa(int b, ArrayList<Integer>[] a, int x, int y, int[] ans) {
				ans[b]=3;
				for(int i=0;i<a[b].size();i++)
				{
					if(ans[a[b].get(i)]!=3)
					{
						ndfa(a[b].get(i),a,x,y,ans);
					}
				}
				//System.out.println(b+" "+ans[b]);
			}

			private static int dfa(int b, ArrayList<Integer>[] a, int x, int y, int[] visited,int[] ans, int temp) {
				visited[b]=1;
				if(visited[x]==1 && visited[y]==1)
					ans[b]=2;
				for(int i=0;i<a[b].size();i++)
				{
					if(visited[a[b].get(i)]==0)
					{
						temp=Math.max(temp,dfa(a[b].get(i),a,x,y,visited,ans,temp));
						if(b==x && temp==1)
							temp++;
					}
				}
				if(b==y)
					temp++;
				if(temp==1 && b!=x && b!=y)
					ans[b]=1;
				if(temp==2)
					ans[b]=0;
				//System.out.println(b+" "+ans[b]+" "+temp);
				return temp;
			}

			static void dfs(int v,int visited[],LinkedList<Integer> l[],Stack<Integer> s)
			{
				visited[v]=1;
				//System.out.println(v+" ");
				for(int i=0;i<l[v].size();i++)
				{
					if(visited[l[v].get(i)]==0)
					{
						dfs(l[v].get(i),visited,l,s);
					}
				}
				s.push(v);
				System.out.println("      "+v+"  ");
			}

			static long modInverse(long A,long M)
			{
			    return modularExpon(A,M-2,M);
			}

			static long modularExpon(long x,long n,long M)
			{
			    long result=1;
			    while(n>0)
			    {
			        if(n % 2 ==1)
			            result=(result * x)%M;
			        x=(x*x)%M;
			        n=n/2;
			    }
			    return result%M;
			}

			static long cost(long a,long b,long c,long d)
			{
				return Math.abs(a-c)+Math.abs(b-d);
			}

			static long cb(long n)
			{
				long count=0;
				while(n>0)
				{
					count+=n%2;
					n=n>>1;
				}
				return count;
			}

			static String [] powerSet()
			{
			    /*set_size of power set of a set with set_size
			      n is (2**n -1)*/
			    int pow_set_size = (int) Math.pow(2,10);
			    int counter, j;
			    String []dig=new String[pow_set_size];
			    /*Run from counter 000..0 to 111..1*/
			    for(counter = 0; counter < pow_set_size; counter++)
			    {
			    	dig[counter]="";
			      for(j = 0; j < 10; j++)
			       {
			          /* Check if jth bit in the counter is set
			             If set then pront jth element from set */
			          if((counter & (1<<j))>0)
			            dig[counter]+=(char)(j+'0');
			       }
			    }
			    return dig;
			}

			static long count_one (long n)
	        {
				long count=0;
	            while( n>0 )
	            {
	            n = n&(n-1);
	               count++;
	            }
	            return count;
	        }

			static boolean isSubsetSum(int set[], int n, int sum)
		    {
		        boolean subset[][] = new boolean[sum+1][n+1];
		        for (int i = 0; i <= n; i++)
		          subset[0][i] = true;
		        for (int i = 1; i <= sum; i++)
		          subset[i][0] = false;
		         for (int i = 1; i <= sum; i++)
		         {
		           for (int j = 1; j <= n; j++)
		           {
		             subset[i][j] = subset[i][j-1];
		             if (i >= set[j-1])
		               subset[i][j] = subset[i][j] ||
		                                          subset[i - set[j-1]][j-1];
		           }
		         }

		         return subset[sum][n];
		    }
			static class Pa {
				long x=0;
				long y=0;
				/*Pair(int xx,int yy,int zz){
					x=xx;
					y=yy;
					z=zz;
				}*/
				public long getx()
				{
					return x;
				}
				public long gety()
				{
					return y;
				}
				public void setx(long xx)
				{
					x=xx;
				}
				public void sety(long yy)
				{
					y=yy;
				}
			}
			static int curr_color(int arr[],int i,int curr[])
			{
				if(curr[i]!=0)
					return curr[i];
				return curr_color(arr,arr[i],curr);
			}

			static long comb(int n,int r,long [][] c)
			{
				if(n<r)
					return 0;
				if(n-r < r)
				{
					c[n][r]=comb(n,n-r,c);
					return c[n][r];
				}
			    if(r == 0)
			    {
			    	c[n][r]=1;
			    	return 1;
			   	}
			    if(c[n][r]!=0)
			    	return c[n][r];
			    else
			    {
			    	c[n][r]=(n*comb(n-1, r-1,c))/r;
			    	return c[n][r];
			    }
			}

			static int IsPandigital(int n)
		    {
		        int digits = 0,temp=n; int count = 0; int tmp = 0;
		        int fr[]=new int[10];
		        for(int i=0;i<10;i++)
		        	fr[i]=0;
		        while(temp>0)
		        {
		        	int a=temp/10;
		        	//System.out.println(temp-a*10);
		        	fr[temp-a*10]++;
		        	temp=temp/10;
		        	digits++;
		        }
		        for(int i=1;i<=digits;i++)
		        {
		        	if(fr[i]==1)
		        	{
		        		tmp=1;
		        	}
		        	else
		        	{
		        		tmp=0;
		        		break;
		        	}
		        }
		        return tmp;
		    }

			static int Divisors(int n)
			{
				int sum=0;
			    for (int i=2; i*i<=n; i++)
			    {
			        if (n/i==0)
			        {
			            if (n/i == i)
			                {sum+=i;//System.out.println(sum+" "+i);
			                }

			            else
			                {sum+=i+(n/i);//System.out.println(sum+" "+i+" "+(n/i));
			                }
			        }
			    }
			    return sum;
			}

			static int findmax(int arr[], int n)
		    {
		        int incl = arr[0];
		        int excl = 0;
		        int excl_new;
		        int i;

		        for (i = 1; i < n; i++)
		        {
		            excl_new = (incl > excl) ? incl : excl;
		            incl = excl + arr[i];
		            excl = excl_new;
		        }
		        return ((incl > excl) ? incl : excl);
		    }

			static long ce(long x)
			{
				if(x/2!=0)
					return x/2+1;
				return x/2;
			}
			static boolean isSubSequence(String str1, String str2, int m, int n)
			{
			   int j = 0;
			   for (int i=0; i<n&&j<m; i++)
			       if (str1.charAt(j) == str2.charAt(i))
			         j++;

			   return (j==m);
			}

			static long fibo(long l) {
		        if (l < 0) {
		            throw new IllegalArgumentException("The fibo value cannot be negative");
		        }

		        if (l <= 1) return l;

		        long[][] result = {{1, 0}, {0, 1}}; // identity matrix.
		        long[][] fiboM = {{1, 1}, {1, 0}};

		        while (l > 0) {
		            if (l/2 == 1) {
		                multMatrix(result, fiboM);
		            }
		            l = l / 2;
		            multMatrix(fiboM, fiboM);
		        }

		        return result[1][0];
		    }

		    private static void multMatrix(long[][] result, long[][] fiboM) {
		        long a = (result[0][0]/mod * fiboM[0][0]/mod)/mod +  (result[0][1]/mod * fiboM[1][0]/mod)/mod;
		        long b = (result[0][0]/mod * fiboM[0][1]/mod)/mod + ( result[0][1]/mod * fiboM[1][1]/mod)/mod;
		        long c = (result[1][0]/mod * fiboM[0][0]/mod)/mod + ( result[1][1]/mod * fiboM[0][1]/mod)/mod;
		        long d = (result[1][0]/mod * fiboM[0][1]/mod)/mod +  (result[1][1]/mod * fiboM[1][1]/mod)/mod;

		        result[0][0] = a;
		        result[0][1] = b;
		        result[1][0] = c;
		        result[1][1] = d;
		    }

		    static HashSet<Long> gr(int size)
		    {
		    	long range=mod;
		    	long m0=2017;
		    	long m1=2027;
		    	long ln=0;
		    	long sln=1;
		    	long mn=0;
		    	HashSet<Long> hs=new HashSet<Long>();
		    	for(int i=0;i<size;i++)
		    	{
		    		long nn=((((ln/mod)*m0)/mod+((sln/mod)*m1)/mod+mn)/mod)+1;
		    		sln=ln;
		    		ln=nn;
		    		mn=Math.max(mn, nn);
		    		hs.add(nn);
		    	}
		    	return hs;
		    }

			static int[] sieve(int n,int[] a)
			{
				a[0]=1;
				a[1]=1;
				for(int i=2;i*i<=n;i++)
				{
					if(a[i]==0)
					{
						for(int j=i*2;j<=n;j+=i)
							a[j]=1;
					}
				}
				return a;
			}

			static int[] spfsieve(int arr[])
			{
				int n=100000;
				arr[0]=1;
				arr[1]=1;
				for(int i=2;i<=n;i++)
					arr[i]=i;
				for(int i=4;i<=n;i+=2)
					arr[i]=2;
				for(int i=3;i*i<=n;i++)
				{
					if(arr[i]==i)
					{
						for(int j=i*i;j<=n;j+=i)
							if (arr[j]==j)
			                    arr[j] = i;
					}
				}
				return arr;
			}

			static boolean isPal(String s)
			{
				for(int i=0, j=s.length()-1;i<=j;i++,j--)
				{
					if(s.charAt(i)!=s.charAt(j)) return false;
				}
				return true;
			}
			public static String rev(String s)
			{
				StringBuilder sb=new StringBuilder(s);
				sb.reverse();
				return sb.toString();
			}

			static long lcm(long a, long b)
			{
				long temp1=a,temp2=b;
			    return ((a * b) / gcd(temp1, temp2));
			}

			static long gcd(long a, long b)
			{
			    if (b==0)
			        return a;
			    return gcd(b, a%b);
			}
			static long modulo(long a,long b,long c) {
				long x=1;
				long y=a;
				while(b > 0){
					if(b/2 == 1){
						x=(x*y)/c;
					}
					y = (y*y)/c; // squaring the base
					b /= 2;
				}
				return  x/c;
			}
			public static void debug(Object... o) {
				System.out.println(Arrays.deepToString(o));
			}

			static class SegmentTree
			{
			    long st[];
			    public SegmentTree(long arr[], int n)
			    {
			        int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));

			        int max_size = 2 * (int) Math.pow(2, x) - 1;

			        st = new long[max_size];

			        constructSTUtil(arr, 0, n - 1, 0);
			    }
			    int getMid(int s, int e) {
			        return s + (e - s) / 2;
			    }

			    long getSumUtil(int ss, int se, int qs, int qe, int si)
			    {
			        if (qs <= ss && qe >= se)
			            return st[si];
			        if (se < qs || ss > qe)
			            return 0;
			        int mid = getMid(ss, se);
			        return getSumUtil(ss, mid, qs, qe, 2 * si + 1) +
			                getSumUtil(mid + 1, se, qs, qe, 2 * si + 2);
			    }

			    void updateValueUtil(int ss, int se, int i, int diff, int si)
			    {
			        if (i < ss || i > se)
			            return;
			        st[si] = st[si] + diff;
			        if (se != ss) {
			            int mid = getMid(ss, se);
			            updateValueUtil(ss, mid, i, diff, 2 * si + 1);
			            updateValueUtil(mid + 1, se, i, diff, 2 * si + 2);
			        }
			    }

			    void updateValue(int arr[], int n, int i, int new_val)
			    {
			        if (i < 0 || i > n - 1) {
			            System.out.println("Invalid Input");
			            return;
			        }

			        // Get the difference between new value and old value
			        int diff = new_val - arr[i];

			        // Update the value in array
			        arr[i] = new_val;

			        // Update the values of nodes in segment tree
			        updateValueUtil(0, n - 1, i, diff, 0);
			    }
			    long getSum(int n, int qs, int qe)
			    {
			        if (qs < 0 || qe > n - 1 || qs > qe) {
			            System.out.println("Invalid Input");
			            return -1;
			        }
			        return getSumUtil(0, n - 1, qs, qe, 0);
			    }

			    long constructSTUtil(long arr[], int ss, int se, int si)
			    {
			        if (ss == se) {
			            st[si] = arr[ss];
			            return arr[ss];
			        }
			        int mid = getMid(ss, se);
			        st[si] = constructSTUtil(arr, ss, mid, si * 2 + 1) +
			                 constructSTUtil(arr, mid + 1, se, si * 2 + 2);
			        return st[si];
			    }
			}
			static class Pair {
				long x=0;
				long y=0;
				long z=0;
				public Pair(int temp, int temp2) {
					x=(long)temp;
					y=(long)temp2;
				}
				/*Pair(int xx,int yy,int zz){
					x=xx;
					y=yy;
					z=zz;
				}*/
				public long getx()
				{
					return x;
				}
				public long gety()
				{
					return y;
				}
				public long getz()
				{
					return z;
				}

				public void setz(long zz)
				{
					z=zz;
				}
				public void setx(long xx)
				{
					x=xx;
				}
				public void sety(long yy)
				{
					y=yy;
				}
			}

			public final static Comparator<Pair> ORIGINAL = new Comparator<Pair>()
		    {
			public int compare(Pair p1,Pair p2)
			{
				if(p1.getx()<p2.getx())
					return -1;
				else if(p1.getx()==p2.getx() && p2.gety()<p1.gety())
					return -1;
				else //if(p1.getx()>p2.getx() || p1.gety()>p2.gety() || p1.getz()>p2.getz())
					return 1;
				/*else
				{
					if(p1.gety()<p2.gety())
						return -1;
					else if(p1.gety()>p2.gety())
						return 1;
					else
					{
						if(p1.getz()<p2.getz())
							return -1;
						else if(p1.getz()>p2.getz())
							return 1;
					}
				}*/
				//return 0;
			}
		    };
		    public final static Comparator<Pair> ORIGINALN = new Comparator<Pair>()
		    {
			public int compare(Pair p1,Pair p2)
			{
				if(p1.getx()>p2.getx())
					return -1;
				else if(p1.getx()==p2.getx() && p2.gety()>p1.gety())
					return -1;
				else //if(p1.getx()>p2.getx() || p1.gety()>p2.gety() || p1.getz()>p2.getz())
					return 1;
				/*else
				{
					if(p1.gety()<p2.gety())
						return -1;
					else if(p1.gety()>p2.gety())
						return 1;
					else
					{
						if(p1.getz()<p2.getz())
							return -1;
						else if(p1.getz()>p2.getz())
							return 1;
					}
				}*/
				//return 0;
			}
		    };

			static class InputReader {
				public BufferedReader reader;
				public StringTokenizer tokenizer;

				public InputReader(InputStream inputstream) {
					reader = new BufferedReader(new InputStreamReader(inputstream));
					tokenizer = null;
				}

				public String nextLine(){
					String fullLine=null;
					while (tokenizer == null || !tokenizer.hasMoreTokens()) {
						try {
							fullLine=reader.readLine();
						} catch (IOException e) {
							throw new RuntimeException(e);
						}
						return fullLine;
					}
					return fullLine;
				}
				public String next() {
					while (tokenizer == null || !tokenizer.hasMoreTokens()) {
						try {
							tokenizer = new StringTokenizer(reader.readLine());
						} catch (IOException e) {
							throw new RuntimeException(e);
						}
					}
					return tokenizer.nextToken();
				}
				public long nextLong() {
					return Long.parseLong(next());
				}
				public int nextInt() {
					return Integer.parseInt(next());
				}
			}

		}
		class Graph
		{
			int vertices;
			LinkedList<Integer> l[];
			Graph(int vertices)
			{
				this.vertices=vertices;
				l=new LinkedList[vertices];
				for(int i=0;i<vertices;i++)
				{
					l[i]=new LinkedList<Integer>();
				}
			}
			void addEdge(int s,int v)
			{
				l[s].add(v);
			}

			void BFS(int s)
			{
				LinkedList<Integer> queue=new LinkedList<Integer>();
				boolean []visited=new boolean[vertices];
				visited[s]=true;
				queue.add(s);
				while(queue.size()>0)
				{
					int r=queue.poll();
					System.out.println(r+" ");
					for(int i=0;i<l[r].size();i++)
					{
						int temp=l[r].get(i);
						if(!visited[temp])
						{
							queue.add(temp);
							visited[temp]=true;
						}
					}
				}
			}

		}

/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class GFG {
	public static void main (String[] args) {
		Scanner sc=new Scanner (System.in);
		int n =sc.nextInt();
		String [] a = sc.next().split("");
		int ind=0;
	    if(n==1){
		        if(a[0].equals("0")){
		            ind=1;
		           // break;
		        }
		    }
	    int count=1;
		for(int i=1;i<n;i++){
		             if((a[0].equals("0") && a[1].equals("0")) || (a[n-1].equals("0") && a[n-2].equals("0"))){
		                ind=1;
		                break;
		            }
		            else if(a[i-1].equals("1") && (!a[i].equals("0"))){
		                ind=1;
		                break;
		            }else if(a[i-1].equals("0") && (!a[i].equals("1"))){
		                count ++;
		                if(count>2){
		                    ind =1;
		                break;
		                }

		            }else if(a[i-1].equals("1") && (a[i].equals("0"))){
		                count=1;
		            }
		}
		if(ind==1){
		    System.out.println("NO");
		}else{
		    System.out.println("YES");
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            if (s.equals("0")) {
                out.print("No");
            } else if (s.contains("11")) {
                out.print("No");
            } else if (s.contains("000")) {
                out.print("No");
            } else if (s.startsWith("00") || s.endsWith("00")) {
                out.print("No");
            } else {
                out.print("Yes");
            }
        }

    }
}

//package R481Div3;

import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class RA {

	static void end()
	{
		System.out.println("No");
		return;
	}
	public static void main(String[] args) {

		FastScanner s = new FastScanner();
		int n = s.nextInt();
		String S = s.nextString();
		char[] c = S.toCharArray();

		char[] p = new char[n];

		if(n==1)
		{
			if(c[0]=='0')
			{
				System.out.println("No");return;
			}
		}
		if(n==2)
		{
			if(S.equals("01")||S.equals("10"))
			{
				System.out.println("Yes");return;
			}
			else
			{
				System.out.println("No");return;
			}
		}

		for(int i=1;i<n;i++)
		{
			if(c[i]=='1'&&c[i-1]=='1')
			{
				System.out.println("No");
				return;
			}
		}

		for(int i=0;i<n-1;i++)
		{
			if(c[i]=='1'&&c[i+1]=='1')
			{
				System.out.println("No");
				return;
			}
		}

		if(S.contains("000")||S.startsWith("00")||S.endsWith("00"))
		{
			System.out.println("No");
			return;
		}

		System.out.println("Yes");

	}
static class FastScanner {

	    private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner() {
			this(System.in);
		}

		public FastScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;

		}

	}

}

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int a[] = new int[n];
    boolean valid = false;
    String text = sc.next();
    for(int i = 0; i < text.length(); i++){
      a[i] = Character.getNumericValue(text.charAt(i));
    }

    if(n==1){
      if(a[0] == 1)
        System.out.println("Yes");
      else
        System.out.println("No");
      return;
    }

    if(n ==2){
      if(text.equals("10") || text.equals("01"))
        System.out.println("Yes");
      else
        System.out.println("No");
      return;
    }

    for(int i = 1; i <= n-2; i++){
		if(a[i] == 0){
			if(a[i-1] == 1 && a[i+1] == 1){
			 valid = true;
			}else if(a[i-1] == 0 && a[i + 1] == 1){
				if(isValidZero(i-1, a) && isValidOne(i+1, a)){
					valid = true;
				} else {
					valid = false;
					break;
				}
			} else if(a[i -1] == 1 && a[i + 1] == 0){
				if(isValidOne(i-1, a) && isValidZero(i+1, a)){
					valid = true;
				} else {
					valid = false;
					break;
				}
			} else{
				valid = false;
				break;
			}
		} else {
			if(a[i-1] == 0 && a[i+1] == 0){
				valid = true;
			} else {
				valid = false;
				break;
			}
		}
    }

    if(valid){
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

  public static boolean isValidZero(int index, int a[]){
		if(index == 0){
			return a[index + 1] != 0;
		}
		if(index == a.length -1){
			return a[index-1] != 0;
		}
		if(a[index - 1] == 1 || a[index + 1] == 1)
			return true;
		else
		  return false;
  }

  public static boolean isValidOne(int index, int a[]){
    if(index == 0){
			return a[index + 1] !=1;
		}
		if(index == a.length -1){
			return a[index-1] != 1;
		}
		if(a[index - 1] == 0 || a[index + 1] == 0)
			return true;
		else
		  return false;
  }
}

import java.io.*;
import java.util.*;

public class Main {
	public static void main (String[] args) {
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    String str = sc.next();
	    char arr[] = str.toCharArray();
	    if(str.indexOf("000") !=-1){
	        System.out.println("No");
	        return;
	    }
	    if(str.equals("0")){
	        System.out.println("No");
	        return;
	    }
	    if(str.startsWith("00")){
	        System.out.println("No");
	        return;
	    }
	    if(str.endsWith("00")){
	        System.out.println("No");
	        return;
	    }
	    if(str.indexOf("11") !=-1){
	        System.out.println("No");
	        return;
	    }
	    System.out.println("Yes");
	}
}

import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class row {

	public static void main(String[] args) throws Exception {
		new row().run();
	}

	public void run() throws Exception {
		FastIO file = new FastIO();
		int n = file.nextInt();
		String s = file.next();
		boolean works = true;
		if (n == 1) works = s.charAt(0) == '1';
		else
		for (int i = 0; i < n; i++) {
			if (i == 0) {
				if (s.charAt(i) == '1' && s.charAt(i + 1) == '1') works = false;
				if (s.charAt(i) == '0' && s.charAt(i + 1) == '0') works = false;
			}
			else if (i == n - 1) {
				if (s.charAt(i) == '1' && s.charAt(i - 1) == '1') works = false;
				if (s.charAt(i) == '0' && s.charAt(i - 1) == '0') works = false;
			}
			else {
				if (s.charAt(i) == '1') {
					if (s.charAt(i - 1) == '1')
					works = false;
					if (s.charAt(i + 1) == '1')
					works = false;
				}
				else {
					if (s.charAt(i - 1) == '0' && s.charAt(i + 1) == '0') works = false;
				}
			}
		}
		System.out.println(works ? "Yes" : "No");
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, (p - 1) / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, (p - 1) / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ankur
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String str = in.readString();
            int prev = -2;
            for (int i = 0; i < n; i++) {
                if (str.charAt(i) == '1') {
                    int gap = i - prev;
                    if (gap >= 4) {
                        out.print("NO");
                        return;
                    }
                    if (gap == 1) {
                        out.print("NO");
                        return;
                    }
                    prev = i;
                }
            }
            if (n - 1 - prev >= 2) {
                out.print("NO");
                return;
            }
            out.print("YES");

        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            //*-*------clare------
//remeber while comparing 2 non primitive data type not to use ==
//remember Arrays.sort for primitive data has worst time case complexity of 0(n^2) bcoz it uses quick sort
//again silly mistakes ,yr kb tk krta rhega ye mistakes
//try to write simple codes ,break it into simple things
//knowledge>rating
        /*
        public class Main
        implements Runnable{
    public static void main(String[] args) {
        new Thread(null,new Main(),"Main",1<<26).start();

    }
    public void run() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();//chenge the name of task
        solver.solve(1, in, out);
        out.close();
    }
         */

            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.TreeMap;

public class Maze {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int nn=s.nextInt();
		String str=s.next();
		//String str=Integer.toString(n);
		boolean flag=false;
		int count=0;
		boolean flaga=false;
		for(int i=0;i<nn;i++){
			if(str.charAt(i)=='1'&&flag){
				flaga=true;
				break;
			}
			if(str.charAt(i)=='1'){
				flag=true;
				count=0;
			}
			else{
				count++;
				flag=false;
			}
			if(count>1&&(i==1||i==nn-1)){
				flaga=true;
				break;
			}
			if(count>2){
				flaga=true;
				break;
			}

		}
	//	System.out.println(num1+" "+num2);
		if(flaga||(nn==1&&str.equals("0"))){
			System.out.println("No");
		}
		else{
			System.out.println("Yes");
		}
	}
}

import java.util.Scanner;

public class Codeforces982ASecand {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        String word = input.next();
        boolean state = true;
        if (n == 1 && word.equals("0") || word.startsWith("00") || word.endsWith("00")){
            System.out.println("No");
            return;
        }
        for (int i = 0; i < n; i++) {
            if (word.charAt(i) == '0'){
                boolean case1 = true;
                boolean case2 = true;
                if (i-1 > -1 && word.charAt(i - 1) != '1'){
                    case1 = false;
                }

                if (i+1 < n && word.charAt(i + 1) != '1'){
                    case2 = false;
                }
                state = case1 || case2;
            } else {
                boolean case1 = true;
                boolean case2 = true;
                if (i-1 > -1 && word.charAt(i - 1) != '0'){
                    case1 = false;
                }

                if (i+1 < n && word.charAt(i + 1) != '0'){
                    case2 = false;
                }
                state = case1 && case2;
            }
            if (!state)
                break;
        }

        System.out.println(state?"Yes":"No");
    }
}

import java.util.Scanner;

public class con5 {

    static Scanner in;

    public static void main(String[] args) {
        in=new Scanner(System.in);
        int n=in.nextInt(),t=0;

        String s=in.next();
        int zero=1,flag=0;
        if(s.charAt(0)=='1'){
            zero=0;
            flag=1;
        }
        for(int i=1;i<s.length();i++){

            if(s.charAt(i)=='1'){
                if(flag==0&&zero>1){
                    System.out.println("No");
                    return;
                }
                if(zero==1||zero==2){

                }else {
                    System.out.println("No");
                    return;
                }
                zero=0;
                flag=1;
            }else{
                ++zero;
            }

        }
        if((zero==1&&n==1)||zero>1){
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        while(cin.hasNext()){
            int n = cin.nextInt();
            String s = cin.next();
            int cnt =s.charAt(0)=='0'?1:0;
            int fg = 0;
            if(n>=2 && (s.charAt(0)==s.charAt(1)&&s.charAt(0)=='0'||s.charAt(s.length()-2)==s.charAt(s.length()-1)&&s.charAt(s.length()-1)=='0')){
                System.out.println("No");
                continue;
            }
            for(int i = 1;i < s.length();i++){
                if(s.charAt(i)=='1'&&s.charAt(i)==s.charAt(i-1)||cnt>=3){
                    fg = 1;
                    break;
                }
                if(s.charAt(i)=='0'){
                    cnt++;
                }
                else {
                    cnt=0;
                }
            }
            if(n==1){
                if(s.charAt(0)=='1'){
                    System.out.println("Yes");
                }
                else{

                    System.out.println("No");
                }
                continue;
            }
            if(fg == 1){
                System.out.println("No");
            }
            else{
                System.out.println("Yes");
            }
        }
    }
}

import java.util.*;

public class JavaApplication89 {
    public static void main(String[] args) {
        Scanner Sc=new Scanner(System.in);

        int n=Sc.nextInt();
        int flag=0;
        String s=Sc.next();

        int c=0;

        if(n==1)
        {
            if(s.charAt(0)=='1')
            {
              System.out.println("Yes");

            }
            else
            {
              System.out.println("No");
            }
            System.exit(0);
        }

        for(int i=0;i<n;i++)
        {
           if(s.charAt(i)=='1')
           {
               if(i>0)
               {
                  if(s.charAt(i-1)!='0')
                  {
//                      System.out.println(i);
                      flag=1;
                  }
               }

               if(i<n-1)
               {
                   if(s.charAt(i+1)!='0')
                   {
//                        System.out.println(i);
                       flag=1;
                   }
               }

           }
           else
           {
                if(i>0 && i<n-1)
               {
                  if(s.charAt(i-1)=='0' && s.charAt(i+1)=='0')
                  {
                      flag=1;
                  }
               }
           }
        }

       // System.out.println("fbbf");

        if(s.charAt(0)=='0' && s.charAt(1)=='0')
        {
            flag=1;
        }

        if(s.charAt(n-1)=='0' && s.charAt(n-2)=='0')
        {

           //System.out.println("fbbf");
            flag=1;
        }

        if(flag==1)
        {
            System.out.println("No");
        }
        else
        {
            System.out.println("Yes");
        }
    }

}

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        boolean b = true;
        if (n==1){
            if (s.charAt(0)=='0')
                b = false;
        }
        for (int i=0;i<n-1;i++){
            if (s.charAt(i)==s.charAt(i+1)&&s.charAt(i)=='1'){
                b = false;
            }
        }

        if (n>=2){
            if (s.charAt(0)=='0'&&s.charAt(1)=='0'){
                b=false;
            }
            if (s.charAt(n-1)=='0'&&s.charAt(n-2)=='0'){
                b = false;
            }
        }

        if (n>=3){
            for (int i=1;i<n-1;i++){
                if (s.charAt(i)=='0'){
                    if (s.charAt(i-1)=='0'&&s.charAt(i+1)=='0')
                        b = false;
                }
            }
        }

        if (b)
            System.out.println("Yes");
        else
            System.out.println("No");

    }
}

import java.util.*;
public class codeforces {
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        char[] arr=s.toCharArray();
        int length=arr.length;
        boolean check=true;

        if(n==1)
        {
            if(arr[0]=='0')
                System.out.println("No");
            else
                System.out.println("Yes");

            return;

        }
        for(int i=0;i<=length-2;i++)
        {
            if(arr[i]=='1' && arr[i+1]=='1') {
                check = false;
                break;
            }

        }

        for(int i=0;i<=length-1;i++)
        {
            if(i==0)
            {
                if(arr[i]=='0' && arr[i+1]=='0'){
                    check=false;
                    break;
                }
            }
            else if(i==length-1)
            {
                if(arr[i]=='0' && arr[i-1]=='0')
                    check=false;
            }
            else if(arr[i]=='0' && arr[i-1]=='0' && arr[i+1]=='0') {
                check = false;
                break;
            }
        }

        if(check)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

import java.util.*;
public class dd {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String x = sc.next();
        int c = 0;
        for (int i = 0; i < x.length() - 1; i++) {
            if (x.charAt(i) == '1')
                c = 0;
            else
                c++;
            if (c > 2 || x.charAt(i) == '1' && x.charAt(i + 1) == '1') {
                System.out.print("No");
                return;
            }
        }
        if (n >= 2 && ((x.charAt(0) == '0' && x.charAt(1) == '0') || (x.charAt(n - 1) == '0' && x.charAt(n - 2) == '0')))
            System.out.print("No");
        else if (n == 1 && x.charAt(0) == '1')
            System.out.print("Yes");
        else if (n == 1 && x.charAt(0) == '0')
            System.out.print("No");
        else
            System.out.print("Yes");

    }
}

import java.io.*;
import java.util.*;

public class Main {
    InputStream is;
    PrintWriter out;
    String INPUT = "";

    int MAX = (int) 1e5, MOD = (int)1e9+7;

    void solve(int TC) {
    	int n = ni();
    	int one=0,zero=0;
    	char[] s = ns(n);
    	if(n == 1) {
    		if(s[0]=='1') pn("Yes");
    		else pn("No");
    		return;
    	}
    	int cnt = 0;
    	char last = '~';
    	boolean canSeat = false, adj = false;
    	if((s[0] == s[1] && s[0] == '0') || (s[n-1] == s[n-2] && s[n-1] == '0')) {
    		pn("No");
    		return;
    	}
    	for(char i: s) {
    	    if(i == '0') ++cnt;
    	    else cnt = 0;
    		if(i == last && i == '1') adj = true;
    		if(cnt > 2) canSeat = true;
    		last = i;
    	}
    	pn(adj || canSeat ? "No" : "Yes");
    }

    boolean TestCases = false;
    public static void main(String[] args) throws Exception { new Main().run(); }

    long pow(long a, long b) {
        if(b==0 || a==1) return 1;
        long o = 1;
        for(long p = b; p > 0; p>>=1) {
            if((p&1)==1) o = (o*a) % MOD;
            a = (a*a) % MOD;
        } return o;
    }

    long inv(long x) {
        long o = 1;
        for(long p = MOD-2; p > 0; p>>=1) {
            if((p&1)==1)o = (o*x)%MOD;
            x = (x*x)%MOD;
        } return o;
    }
    long gcd(long a, long b) { return (b==0) ? a : gcd(b,a%b); }
    int gcd(int a, int b) { return (b==0) ? a : gcd(b,a%b); }

    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        out = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        int T = TestCases ? ni() : 1;
        for(int t=1;t<=T;t++) solve(t);
        out.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

    void p(Object o) { out.print(o); }
    void pn(Object o) { out.println(o); }
    void pni(Object o) { out.println(o);out.flush(); }
    double PI = 3.141592653589793238462643383279502884197169399;

    int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-') {
            minus = true;
            b = readByte();
        }
        while(true) {
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-') {
            minus = true;
            b = readByte();
        }
        while(true) {
            if(b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    double nd() { return Double.parseDouble(ns()); }
    char nc() { return (char)skip(); }

    int BUF_SIZE = 1024 * 8;
    byte[] inbuf = new byte[BUF_SIZE];
    int lenbuf = 0, ptrbuf = 0;

    int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        } return inbuf[ptrbuf++];
    }

    boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))) {
            sb.appendCodePoint(b); b = readByte();
        } return sb.toString();
    }

    char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        } return n == p ? buf : Arrays.copyOf(buf, p);
    }

    void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}

import java.util.Scanner;

public class Row {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int i,sum,j,n;
        boolean is;
        String s,s1;
        while (input.hasNext()){
            n = input.nextInt(); s1 = input.nextLine(); is = false; sum = 0;

            s = input.nextLine();
            if (n == 1 && (s.charAt(0) == '1')){
                is = false;
            }
            else if (n == 1 && (s.charAt(0) == '0')) is = true;

            if (n == 2 && (s.charAt(0) == '1' || s.charAt(1) == '0') && (s.charAt(0) == '0' || s.charAt(1) == '1')) is = false;

            if (n == 2 && s.charAt(0) == '0' && s.charAt(1) == '0') is = true;

            if (n != 1 && s.charAt(0) == '0' && s.charAt(1) == '0') is = true;

            for (i=0; i<n-1; i++){
                if (s.charAt(i) == '1' && s.charAt(i+1) == '1') is = true;
            }
            if (!is){
                for (i=0; i<n; i++){
                    sum = 0;
                    if (s.charAt(i) == '0'){
                        while (i<n && s.charAt(i) != '1'){
                            sum++;
                            i++;
                        }
                        i--;
                        if (n == i+1 && sum == 2){
                            is = true;
                            break;
                        }
                    }
                    if (sum >= 3) {
                        is = true;
                        break;
                    }

                }
            }

            if (!is) System.out.println("YES");
            else System.out.println("NO");

        }
    }
}

import java.util.*;
		public class mohamedy23
		{
	      public static void main (String args[])
		    {
		    	Scanner sc=new Scanner(System.in);
		    	int n=sc.nextInt();String s=sc.next();int i=s.length()-1;

		    	if(n==1) {
		    		if(s.charAt(0)=='1') {
		    			System.out.print("YES");return;
		    		}else {
		    			System.out.print("NO");return;
		    		}
		    	}else if(n==2) {
		    		if(s.contains("00")||s.contains("11")) {
		    			System.out.print("NO");return;
		    		}else {
		    			System.out.print("Yes");return;
		    		}
		    	}
		    	else if(s.contains("000")||s.contains("11")) {
		    		System.out.print("NO");return;
		    	}
		    	else	if(s.charAt(0)=='0'&&s.charAt(1)=='0'&&s.charAt(2)=='1') {
		    		System.out.print("NO");return;
		    	}
		    	else	if(s.charAt(i)=='0'&&s.charAt(i-1)=='0') {
		    		System.out.print("NO");
		    		return;
		    		}
		    	 System.out.print("YES");
		    }
		}

import java.util.*;
public class HelloWorld{

      static void fun(String str,int n)
      {
          if(str.equals("1"))
          {
            System.out.print("Yes");
                return ;
          }
          if(str.equals("0"))
          {
              System.out.print("No");
                return ;
          }
          String st="";
          for(int i=0;i<n-1;i++)
          {
              st=str.substring(i,i+2);
              if(st.equals("11"))
              {
              System.out.print("No");
                return ;
              }
          }
           for(int i=0;i<n-2;i++)
         {
             st=str.substring(i,i+3);
             if(st.equals("000"))
             {
                 System.out.print("No");
                     return ;
             }
         }
          st=str.substring(0,2);
          if(st.equals("00"))
          {
              System.out.print("No");
                 return ;
          }
          st=str.substring(n-2,n);
          if(st.equals("00"))
          {
              System.out.print("No");
                 return;
          }

         System.out.print("Yes");

      }
     public static void main(String []args)
     {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        String str=s.next();
        fun(str,n);
     }
}

import java.util.Scanner;

public class Sloution1 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		if(n==1)
		{	String str = sc.next();
			int p =str.charAt(0);
			if(p=='1')
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		else
		{
			int flag=0;
			String str = sc.next();
			int[] arr = new int[n];

		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(str.charAt(i)+"");
		}
		for(int i=0;i<n-1;i++)
		{
			if(arr[i]==arr[i+1])
			{
				if(arr[i]==1)
				{
					flag=1;
					break;
				}
				else if(i==0 && arr[i]==0) { flag=1; break; }
				else if(arr[i]==0 && arr[i-1]==0) { flag=1; break; }
				else if(arr[i]==0 && i+1==n-1) { flag=1; break; }
			}
		}
		System.out.println(flag==1 ? "NO" : "YES");
		}
	}
}

import java.util.Scanner;
public class Codeforces {
 public static void main(String args[]) {
	 Scanner sc = new Scanner(System.in);
	 int n = sc.nextInt();
	 int ctr=0;
	 int flag=0;
	 String s = sc.next();
	 for(int i=0;i<s.length();i++)
	 {
		 if(i>0&&s.charAt(i)=='1'&&s.charAt(i-1)=='1')flag=1;
		 if(i==1&&s.charAt(i-1)=='0'&&s.charAt(i)=='0')flag=1;
		 if(i==s.length()-1&&i>0&&s.charAt(i-1)=='0'&&s.charAt(i)=='0')flag=1;
		if(i>0&&i<s.length()-1&&s.charAt(i-1)=='0'&&s.charAt(i)=='0'&&s.charAt(i+1)=='0')flag=1;

	 }
	 if(s.length()==1&&s.charAt(0)=='0')flag=1;
	 if(flag==1)
	 System.out.println("No");
	 else System.out.println("Yes");

 }
}

import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException {
		InputStreamReader read=new InputStreamReader(System.in);
		BufferedReader in=new BufferedReader(read);
		int n=Integer.parseInt(in.readLine());
		String str=in.readLine();
		if(str.equals("0"))
		System.out.println("No");
		else if(str.contains("11"))
		System.out.println("No");
		else if(str.contains("000"))
		System.out.println("No");
		else if(str.startsWith("00") || str.endsWith("00"))
		System.out.println("No");
		else
		System.out.println("Yes");
	}
}

import java.util.Scanner;

public class ProblemA {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.next();
        boolean invalid = false;
        for (int i = 0 ; i < n ; i++){
            char current = str.charAt(i);

            if( current == '1' && (i+1 <= str.length()-1 && str.charAt(i+1) =='1')){
                invalid = true;
            }
            else if(current == '0'){
                invalid = (i-1 >= 0? (str.charAt(i-1) =='0') : true );
                invalid &= (i+1 <= str.length()-1? (str.charAt(i+1) =='0') : true );
            }

            if(invalid)
                break;

        }

        if(!invalid)
            System.out.println("Yes");
        else System.out.println("No");
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

import javax.swing.JOptionPane;

public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();
		char a = '0';

		if(N!=s.length()) {

			System.out.println("No");
			return;

		}

		if(N==1) {

			if(s.charAt(0)=='0') {

				System.out.println("No");
				return;

			}
			else {

				System.out.println("Yes");
				return;

			}

		}

		 for (int i = 0; i < N; i++) {

			 if(s.charAt(i)=='1') {

				 if(i==0) {

					 if(s.charAt(i+1)=='1') {
						 System.out.println("No");
						 return;
					 }

				 }
				 else if(i==N-1) {

					 if(s.charAt(i-1)=='1') {
						 System.out.println("No");
						 return;
					 }

				 }
				 else {

					 if(s.charAt(i-1)=='1'||s.charAt(i+1)=='1') {
						 System.out.println("No");
						 return;
					 }

				 }

			 }

		 }

		 for(int i=0;i<N-2;i++) {

			 if(s.charAt(i)=='0'&&s.charAt(i+1)=='0') {

				 if(i>0) {

					 if(s.charAt(i-1)=='1') {

						 if(s.charAt(i+2)!='1') {

							 System.out.println("No");
							 return;
						 }

					 }

				 }
				 else {

					 System.out.println("No");
					 return;

				 }

			 }

		 }

		 if(s.charAt(N-2)=='0') {

			 if(s.charAt(N-1)=='0') {

				 System.out.println("No");
				 return;

			 }

		 }
		 else {
			 if(s.charAt(N-1)=='1') {

				 System.out.println("No");
				 return;

			 }

		 }

		System.out.println("Yes");

	}

}

import java.io.*;
import java.util.*;
public class q2
{
  public static void main(String args[])throws IOException
  {
    //Scanner in=new Scanner(System.in);
    FastReader in=new FastReader();
    PrintWriter pw=new PrintWriter(System.out, true);
    int n=in.nextInt();
    String str=in.next();
    str="0"+str+"0";
    int count=0;
    for(int i=1;i<=n;i++)
  	{
  		if(str.charAt(i)=='1')
  		{
  			if(str.charAt(i-1)=='1' || str.charAt(i+1)=='1')
  			{
  				pw.println("No");
  				return;
  			}
  		}
  		else
  		{
  			if(str.charAt(i-1)=='0' && str.charAt(i+1)=='0')
        count++;
  		}
  	}
	   pw.println(count>0?"No":"Yes");
  }
}
class FastReader
  {
      BufferedReader br;
      StringTokenizer st;

      public FastReader()
      {
          br = new BufferedReader(new
                   InputStreamReader(System.in));
      }

      String next()
      {
          while (st == null || !st.hasMoreElements())
          {
              try
              {
                  st = new StringTokenizer(br.readLine());
              }
              catch (IOException  e)
              {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }

      int nextInt()
      {
          return Integer.parseInt(next());
      }

      long nextLong()
      {
          return Long.parseLong(next());
      }

      double nextDouble()
      {
          return Double.parseDouble(next());
      }

      String nextLine()
      {
          String str = "";
          try
          {
              str = br.readLine();
          }
          catch (IOException e)
          {
              e.printStackTrace();
          }
          return str;
      }
  }

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class a{
    public static void main(String[] args)throws Exception{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          int n = Integer.parseInt(br.readLine());
	     String s = br.readLine();
     	System.out.println(s.contains("11") || s.contains("000")|| s.startsWith("00") || s.endsWith("00") || s.equals("0")?"No":"Yes");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A982 {
   public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        String s = br.readLine();
        boolean set = true;

        if(t == 1 && s.charAt(0) == '0')
            set = false;
        else if(t >= 3 && s.charAt(0) == '0' && s.charAt(1) == '0'&& s.charAt(2) == '1')
            set = false;

        for(int i = 0; i < t-1 && set; i++)
            if(s.charAt(i) == '1' && s.charAt(i+1) == '1' || (i < t-2 && s.charAt(i) == '0' && s.charAt(i+1) == '0' && s.charAt(i+2) == '0') || (i == t-2 && s.charAt(i) == '0' && s.charAt(i+1) == '0') )
                set = false;

        System.out.println(set? "Yes" : "No");
    }
}

import java.util.*;

public class Main{
	public static void main(String[] args){

		Scanner entrada = new Scanner(System.in);
		int assentos = entrada.nextInt();
		entrada.nextLine();
		String disposicao = entrada.nextLine();

		boolean regraA = !disposicao.contains("11");
		boolean regraB = true;

		if(disposicao.equals("0") || disposicao.startsWith("001")){
			System.out.println("No");
			return;
		}

		if(regraA){
			disposicao += 0;

			for(int i = 1; i<disposicao.length()-1; i++){
				if(disposicao.charAt(i) == '0'){

					String previous = "" + disposicao.charAt(i-1) + "1";
					String next = "" + 1 + disposicao.charAt(i+1);

					if(!(previous.equals("11") || next.equals("11"))){
						regraB = false;
						break;
					}
				}
			}
		}

		boolean isMaxima = regraA && regraB ? true : false;

		System.out.println(isMaxima ? "Yes" : "No");
	}
}

  import java.io.*;
    import java.util.*;

        public class Codeforces {

    		   public static long log2(long x)
    			{
    				long p=1;
    				long ans=0;
    				while(x>=p)
    				{
    					p*=2;
    					ans++;
    				}
    				return ans-1;
    			}

    		   public static void extendedgcd(int a, int b)
    		   {
    			   x=0;
    			   y=0;
    			   gc=0;
    			   xgcd(a,b);
    			   pw.println(a+"*"+x+" + "+b+"*"+y+" = "+gc);

    		   }

    		   public static long modex(long a, long b, long c)
    		   {
    			   if(b==0)
    				   return 1;
    			   else if(b==1)
    				   return a%c;
    			   else if(b%2==0)
    			   {
    				   	return modex((a*a)%c,b/2,c);
    			   }
    			   else
    			   {
    				   return (a*modex((a*a)%c,b/2,c))%c;

    			   }

    		   }

    		   public static void xgcd(int a, int b)
    		   {

    			   if(b==0)
    			   {
    				   x=1;
    				   y=0;
    				   gc=a;

    			   }
    			   else
    			   {
    				   xgcd(b,a%b);
    				   int temp = x;
    				   x=y;
    				   y = temp - ((a/b)*y);

    			   }
    		   }

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

    		   }

    		   static int x,y,gc;

    		   static HashSet<Character> set;

    		   public static int expmod(int a, int b, int mod)
    		   {
    			   if(b==0)return 1;
    			   if(b==1)return a;

    			   if(b%2==0)
    			   {
    				   return ((expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    			   else
    			   {
    				   return ((a%mod)*(expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    		   }

    		   static class Comp implements Comparator<Point>
    		   {

				@Override
				public int compare(Point arg0, Point arg1) {

					if(arg0.x>arg1.x)return 1;
					if(arg0.x<arg1.x)return -1;
					return 0;
				}

    		   }
    		   static class Point
    		   {
    			   int x,y,ind;

    			    public Point(int a, int b, int i)
    			    {
    			    	x=a;
    			    	y=b;
    			    	ind=i;
    			    }

    		   }

    		   public static void main(String[] args)
    	   {
    			//a=97

    			int n = sc.nextInt();

    			String st = sc.nextLine();

    			int flg=1;

    			char arr[] = st.toCharArray();

    			if(n==1)
    			{
    				if(arr[0]=='0')pw.println("No");
    				else pw.println("Yes");
    				return ;
    			}

    			for(int i=0;i<n-1;i++)
    			{
    				if(arr[i]=='1'&&arr[i+1]=='1')
    				{
    					flg=0; break;
    				}

    			}

    			if(flg==0)
    			{
    				pw.println("No");
    				return ;
    			}

    			for(int i=0;i<n;i++)
    			{
    				if(arr[i]=='0')
    				{
    					if(i==0)
    					{
    						if(arr[i+1]=='0')
    						{
    							flg=0; break;
    						}

    					}
    					else if(i==n-1)
    					{
    						if(arr[i-1]=='0')
    						{
    							flg=0; break;
    						}

    					}

    					else
    					{
    						if(arr[i-1]=='0'&&arr[i+1]=='0')
    						{
    							flg=0; break;
    						}

    					}
    				}

    			}

    			String an = (flg==1)?"Yes":"No";

    			pw.println(an);
    			pw.close();

    	   }

    		   static  class MyScanner
    			{

    			BufferedReader br;
    			StringTokenizer st;

    			public MyScanner()
    			{
    				br = new BufferedReader(new InputStreamReader(System.in));
    			}

    			String next()
    			{

    				while (st == null || !st.hasMoreElements())
    				{
    					try
    					{
    						st = new StringTokenizer(br.readLine());
    					} catch (IOException e)
    					{
    						e.printStackTrace();
    					}
    				}
    				return st.nextToken();
    			}

    			int nextInt()
    			{
    				return Integer.parseInt(next());
    			}

    			long nextLong()
    			{
    				return Long.parseLong(next());
    			}

    			double nextDouble()
    			{
    				return Double.parseDouble(next());
    			}

    			String nextLine()
    			{
    				String str = "";
    				try
    				{
    					str = br.readLine();
    				} catch (IOException e)
    				{
    					e.printStackTrace();
    				}
    				return str;
    			}

    		}

    		static MyScanner sc = new  MyScanner();
    		static PrintWriter pw = new PrintWriter(System.out, true);

    	}

 import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner console = new Scanner(System.in);
		int n = console.nextInt();
		console.nextLine();
		String s = console.nextLine();
		if(n == 1 && s.equals("0")) {
			System.out.println("No");
			return;
		}
		if (s.contains("000") ||s.contains("11"))
			System.out.println("No");
		else if(s.length() >= 2 && (s.substring(0, 2).equals("00") || s.substring(s.length() - 2, s.length()).equals("00")))
			System.out.println("No");
		else
			System.out.println("Yes");
	}

}

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Watermelon {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out=new PrintWriter(System.out);
        StringTokenizer st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());int[] arr=new int[n];
        String s=(br.readLine());
        for(int i=0;i<n;i++){
            arr[i]=Integer.parseInt(s.charAt(i)+"");
        }
        if(n==1){
            if(arr[0]!=1)
                System.out.println("no");
            else System.out.println("yes");
            System.exit(0);
        }
        int count=0;
        for(int i=0;i<n;i++){
            int flag=0,flag1=0;
            if(arr[i]==1) {
                count+=1;
                if (i == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey1");
                    flag=1;
                }
                if (i>0 && i<n-1 && arr[i - 1] == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey2");
                    flag=1;
                }
                if (i == n - 1 && arr[i - 1] == 0){
//                    System.out.println("Hey3");
                    flag=1;
                }
            }
            else{
                if (i == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey1");
                    flag1=1;
                }
                if (i>0 && i<n-1 && arr[i - 1] == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey2");
                    flag1=1;
                }
                if (i == n - 1 && arr[i - 1] == 0){
//                    System.out.println("Hey3");
                    flag1=1;
                }
            }
            if((arr[i]==1 && flag==0) || (arr[i]==0 && flag1==1)){
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("yes");

    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nirav
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scan in = new Scan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARow solver = new ARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARow {
        public void solve(int testNumber, Scan in, PrintWriter out) {
            int n = in.scanInt();
            String str = in.scanString();
            boolean check = true;

            for (int i = 1; i < str.length() - 1; i++) {
                if (str.charAt(i - 1) == '0' && str.charAt(i + 1) == '0' && str.charAt(i) == '0') {
                    check = false;
                }

                if ((str.charAt(i - 1) == '1' || str.charAt(i + 1) == '1') && str.charAt(i) == '1') {
                    check = false;
                }

            }

            if (n > 2) {

                if (str.charAt(1) == '0' && str.charAt(0) == '0') {
                    check = false;
                }

                if (str.charAt(n - 2) == '0' && str.charAt(n - 1) == '0') {
                    check = false;
                }

                if (str.charAt(n - 2) == '1' && str.charAt(n - 1) == '1') {
                    check = false;
                }
                if (str.charAt(1) == '1' && str.charAt(0) == '1') {
                    check = false;
                }

            }
            if (n == 1) {
                if (str.charAt(0) == '0') {
                    check = false;
                } else {
                    check = true;
                }
            }

            if (n == 2) {
                if (str.charAt(0) == '0' && str.charAt(1) == '0') {
                    check = false;
                }
                if (str.charAt(0) == '1' && str.charAt(1) == '0') {
                    check = true;
                }
                if (str.charAt(0) == '1' && str.charAt(1) == '0') {
                    check = true;
                }
                if (str.charAt(0) == '1' && str.charAt(1) == '1') {
                    check = false;
                }

            }

            if (check) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class Scan {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan() {
            in = System.in;
        }

        public Scan(InputStream inputStream) {
            in = inputStream;
        }

        public int scan() {
            if (total < 0) {
                return 0;
            }
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    System.out.println(e);
                }
                if (total <= 0)
                    return -1;

            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else throw new InputMismatchException();
            }
            return neg * integer;
        }

        public String scanString() {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }

    }
}

import java.util.*;

public class JavaApplication89 {
    public static void main(String[] args) {
        Scanner Sc=new Scanner(System.in);

        int n=Sc.nextInt();
        int flag=0;
        String s=Sc.next();

        int c=0;

        if(n==1)
        {
            if(s.charAt(0)=='1')
            {
              System.out.println("Yes");

            }
            else
            {
              System.out.println("No");
            }
            System.exit(0);
        }

        for(int i=0;i<n;i++)
        {
           if(s.charAt(i)=='1')
           {
               if(i>0)
               {
                  if(s.charAt(i-1)!='0')
                  {
//                      System.out.println(i);
                      flag=1;
                  }
               }

               if(i<n-1)
               {
                   if(s.charAt(i+1)!='0')
                   {
//                        System.out.println(i);
                       flag=1;
                   }
               }

           }
           else
           {
                if(i>0 && i<n-1)
               {
                  if(s.charAt(i-1)=='0' && s.charAt(i+1)=='0')
                  {
                      flag=1;
                  }
               }
           }
        }

       // System.out.println("fbbf");

        if(s.charAt(0)=='0' && s.charAt(1)=='0')
        {
            flag=1;
        }

        if(s.charAt(n-1)=='0' && s.charAt(n-2)=='0')
        {

           //System.out.println("fbbf");
            flag=1;
        }

        if(flag==1)
        {
            System.out.println("No");
        }
        else
        {
            System.out.println("Yes");
        }
    }

}

import java.util.Scanner;

public class Sloution {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		if(n==1)
		{
			String str = sc.next();
			int p =str.charAt(0);
			if(p=='1')
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		else if(n==2)
		{
			String str = sc.next();
			int p = str.charAt(0);
			int q = str.charAt(1);

			if((p=='1' && q=='1') || (p=='0' && q=='0'))
					System.out.println("NO");
			else
					System.out.println("YES");
		}
		else if(n==3)
		{
			String str = sc.next();
			int p = str.charAt(0);
			int q = str.charAt(1);
			int r = str.charAt(2);

			if((p=='1' && q=='0' && r=='1') || (p=='0' && q=='1' && r=='0'))
			{
				System.out.println("YES");
			}
			else
			{
				System.out.println("NO");
			}
		}
		else
		{
			int flag=0;
			String str = sc.next();
			int[] arr = new int[n];

		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(str.charAt(i)+"");
		}
		//System.out.println(Arrays.toString(arr));
		for(int i=0;i<n-1;i++)
		{
			if(arr[i]==arr[i+1])
			{
				if(arr[i]==1)
				{
					flag=1;
					break;
				}
				else if(i==0 && arr[i]==0) { flag=1; break; }
				else if(arr[i]==0 && arr[i-1]==0) { flag=1; break; }
				else if(arr[i]==0 && i+1==n-1) { flag=1; break; }
				//else if(i==0 && )

			}

		}
		//System.out.println(flag);
		System.out.println(flag==1 ? "NO" : "YES");

		}
	}

}

import java.util.Scanner;

public class Sloution1 {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		if(n==1)
		{	String str = sc.next();
			int p =str.charAt(0);
			if(p=='1')
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		else
		{
			int flag=0;
			String str = sc.next();
			int[] arr = new int[n];

		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(str.charAt(i)+"");
		}
		for(int i=0;i<n-1;i++)
		{
			if(arr[i]==arr[i+1])
			{
				if(arr[i]==1)
				{
					flag=1;
					break;
				}
				else if(i==0 && arr[i]==0) { flag=1; break; }
				else if(arr[i]==0 && arr[i-1]==0) { flag=1; break; }
				else if(arr[i]==0 && i+1==n-1) { flag=1; break; }
			}
		}
		System.out.println(flag==1 ? "NO" : "YES");
		}
	}
}

import java.util.*;

public class seating{

	public static void main(String[] args){
		int n;
		Scanner s = new Scanner(System.in);
		n=s.nextInt();
		String chairs;
		chairs=s.next();
		int i;
		String ans=null;
		char c;

		if(n==1){
			if(chairs.charAt(0) == '1')
				ans = "yes";
			else
				ans = "no";
		}

		else if(n==2){
			if(chairs.charAt(0) != chairs.charAt(1)){
				ans = "yes";
			}
			else{
				ans = "no";
			}
		}

		else {

			for(i=1;i<n-1;i++){
				if(chairs.charAt(i) == '1'){
					if(chairs.charAt(i-1) != chairs.charAt(i+1)){
						ans = "no";
						break;
					}
					else{
						ans = "yes";
					}
				}
				else{
					if(chairs.charAt(i-1) == chairs.charAt(i+1) && chairs.charAt(i+1) == '0'){
						ans = "no";
						break;
					}
					else{
						ans = "yes";
					}

				}
			}
			if(chairs.charAt(0) == chairs.charAt(1)){
					ans = "no";
			}
			else if(chairs.charAt(n-2) == chairs.charAt(n-1)){
				ans = "no";
			}

		}

		System.out.println(ans);
	}
}

import java.util.Arrays;
import java.util.Scanner;

public class RowSingleFile {

	private static boolean check(int seatQty, String seatOccupancy) {
		char prevSeats[] = new char[2];
		prevSeats[0] = seatOccupancy.charAt(0);
		prevSeats[1] = seatOccupancy.charAt(0);
        boolean isMax = true;
        if(seatQty==1 && prevSeats[1] == '0') return false;
        for(int i=1; i<seatQty; i++) {

			if ((seatOccupancy.charAt(i) == prevSeats[1] && prevSeats[1] == '1') ||
			(seatOccupancy.charAt(i) == prevSeats[1] && prevSeats[0] == prevSeats[1])){
				isMax = false;
        		break;
        	}
			prevSeats[0] = prevSeats[1];
			prevSeats[1] = seatOccupancy.charAt(i);
        }
        if(prevSeats[0] == prevSeats[1] && prevSeats[0] == '0')
        	isMax = false;
        return isMax;
	}

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
		    String seatQty = scanner.nextLine();
		    String seatOccupation = scanner.next();
		    boolean rowMaximal = check(Integer.parseInt(seatQty.trim()),seatOccupation);
	        System.out.println(rowMaximal?"Yes":"No");
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int flag = 0;
		char a[] = new char[n];
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s;
		s = sc.next();
		for(int i = 0 ; i < n ; i++)
		{
			char c = s.charAt(i);
			a[i]=c;
		}
		if(n == 1)
		{
			if(a[0] == '0')
			{
				System.out.println("No");
				System.exit(0);
			}
			else
			{
				System.out.println("Yes");
				System.exit(0);
			}
		}
		for(int i = 0 ; i < n ; i++)
		{
			if(i == 0)
			{
				if(a[0] == '1')
				{
					if(a[1] == '1')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
				else
				{
					if(a[1] == '0')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
			}
			else if(i == (n -1))
			{
				if(a[i] == '1')
				{
					if(a[i - 1] == '1')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
				else
				{
					if(a[i - 1] == '0')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
			}
			else
			{
				if(a[i] == '1')
				{
					if(a[i + 1] == '1' || a[i - 1] == '1')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
				else
				{
					if(a[i + 1] == '0' && a[i - 1] == '0')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
			}
		}
		System.out.println("Yes");
		sc.close();
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anshh31
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemARow solver = new ProblemARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemARow {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            String seats = in.next();
            boolean neighbour1 = false, neighbour0 = false;
            for (int i = 0; i < n; i++) {
                if (i != n - 1 && seats.charAt(i) == '1' && seats.charAt(i + 1) == '1') neighbour1 = true;
                if (i - 1 >= 0 && i + 1 <= n - 1 && seats.charAt(i) == '0' && seats.charAt(i + 1) == '0' && seats.charAt(i - 1) == '0')
                    neighbour0 = true;
            }
            if (n >= 2 && (seats.charAt(0) == '0' && seats.charAt(1) == '0'))
                neighbour0 = true;
            else if (n >= 2 && (seats.charAt(n - 2) == '0' && seats.charAt(n - 1) == '0'))
                neighbour0 = true;
            if (neighbour1 || neighbour0 || (n == 1 && seats.charAt(0) == '0'))
                out.println("No");
            else
                out.println("Yes");

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Unstoppable solver = new Unstoppable();
	//	int t=in.nextInt();
	//	while(t-->0)
        solver.solve(in, out);
        out.close();
    }

    static class Unstoppable {

         public void solve(InputReader in, PrintWriter out) {
         int n=in.nextInt();
         int flag=0;
         char ch[]=in.next().toCharArray();
         for(int i=0;i<n;i++){
             if(ch[i]=='1'){
                 if(i>0&&ch[i-1]=='1') flag=1;
                 if(i<n-1&&ch[i+1]=='1') flag=1;
             }
         }
         for(int i=0;i<n;i++){
              if(ch[i]=='0'){
                 if(i>0&&ch[i-1]=='0'&&i<n-1&&ch[i+1]=='0') flag=1;
                 if((i==0&&i+1<n&&ch[i+1]=='0')||n==1) flag=1;
                 if(i==n-1&&i-1>=0&&ch[i-1]=='0') flag=1;
             }

         }
        if(flag==0) out.println("Yes");
        else out.println("No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public long nextLong(){
            return Long.parseLong(next());
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.*;
import java.text.ParseException;
import java.util.*;

public class Main {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static StringBuilder sb = new StringBuilder();
    private static final int mod = (int)1e9 + 7;

    static int[] inputArray() throws IOException {
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        st = new StringTokenizer(br.readLine());
        for(int i = 0 ; i < n ; i++) {
            a[i] = Integer.parseInt(st.nextToken());
        }
        return a;
    }

    static long[][] inputPoints(int n) throws IOException {
        long[][] a = new long[n][3];
        for(int i = 0 ; i < n ;i++) {
            st = new StringTokenizer(br.readLine());
            a[i][0] = Long.parseLong(st.nextToken());
            a[i][1] = Long.parseLong(st.nextToken());
            a[i][2] = i;
        }
        return a;
    }

    public static void main(String[] args) throws IOException, ParseException {
        int n = Integer.parseInt(br.readLine());
        String s = br.readLine();
        boolean possible = true;
        if(n == 1) {
            if(s.charAt(0) == '1')
                System.out.println("Yes");
            else
                System.out.println("No");
        }
        else {
            for(int i = 0 ; i < n - 1 ; i++) {
                if(i <= n - 3) {
                    if (s.charAt(i) == '0' && s.charAt(i + 1) == '0' && s.charAt(i + 2) == '0') {
                        possible = false;
                        break;
                    }
                }
                if(s.charAt(i) == '1' && s.charAt(i+1) == '1') {
                    possible = false;
                    break;
                }
            }
            if(possible && (!(s.charAt(0) == '0' && s.charAt(1) == '0')) && (!(s.charAt(n-2) == '0' && s.charAt(n-1) == '0'))) {
                System.out.println("Yes");
            }
            else {
                System.out.println("No");
            }
        }
    }

    private static int Code(int[] a) {
        int n = a.length;
        int freq[] = new int[n];
        for (int i = 0; i < n; i++) {
            freq[a[i]]++;
        }
        ArrayList<Integer> unique = new ArrayList<>();
        for(int i = 0 ; i < n ;i++) {
            if(freq[i] > 0) {
                unique.add(i);
            }
        }
        for(int element : unique) {
            for(int i = 1 ; i <= freq[element] ; i++) {

            }
        }
        return 0;
    }

    private static long[] createPreSum(long[] dp , int n) {
        long[] preSum = new long[n+1];
        preSum[0] = 0;
        for(int i = 1 ; i <= n ; i++) {
            preSum[i] = (preSum[i-1] + dp[i]) % mod;
        }
        return preSum;
    }

    static long[] createDP(int k , int n) {
        long[] dp = new long[n+1];
        dp[0] = 1;
        for(int i = 1 ; i <= n ; i++) {
            if(i >= k) {
                dp[i] = (dp[i] + dp[i-k]) % mod;
            }
            dp[i] = (dp[i] + dp[i-1]) % mod;
        }
        return dp;
    }

}

import java.util.Scanner;

public class Raf {
     static Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {

	   int nint=sc.nextInt();

	   String n=sc.next();
	   String zero="0";
	   String One="1";
	   String dOne="11";
	   String sl="00";
	   String check="000";

	   if(n.length()==1) {
		   if(n.indexOf(One)==0) {
		   System.out.println("Yes");
	     }
		   else if(n.indexOf(zero)==0) {
			   System.out.println("No");
		   }
		   }

        else if(n.indexOf(check)!=(-1) || n.indexOf(dOne) !=(-1) || n.indexOf(sl)==0)  {
		  System.out.println("No");
	  }else if(n.charAt(n.length()-2)=='0' && n.charAt(n.length()-1)=='0') {
	   System.out.println("No");
	   }else {
		System.out.println("Yes");
	}

	}
}

import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		FastScanner input = new FastScanner(System.in);

		int N = input.nextInt();
		String s = input.next();

		System.out.println(s.equals("0") || s.contains("11") || s.contains("000") ||
				s.startsWith("00") || s.endsWith("00") ? "No" : "Yes");
	}

	// Matt Fontaine's Fast IO
	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class Main1
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////
    //    RRRRRRRRR            AAA             HHH     HHH     IIIIIIIIIIIII   LLL           //
    //    RR    RRR           AAAAA            HHH     HHH      IIIIIIIIIII    LLL           //
    //    RR   RRR           AAAAAAA           HHH     HHH          III        LLL           //
    //    RR  RRR           AAA   AAA          HHHHHHHHHHH          III        LLL           //
    //    RRRRRR           AAA     AAA         HHHHHHHHHHH          III        LLL           //
    //    RR  RRR         AAAAAAAAAAAAA        HHH     HHH          III        LLL           //
    //    RR    RRR      AAA         AAA       HHH     HHH      IIIIIIIIIII    LLLLLLLLLLLL  //
    //    RR     RRR    AAA           AAA      HHH     HHH     IIIIIIIIIIIII   LLLLLLLLLLLL  //
    ///////////////////////////////////////////////////////////////////////////////////////////

    public static void main(String[] args)throws IOException
    {
        PrintStream out= new PrintStream(System.out);
        Reader sc=new Reader();
        int n=sc.i();
        String s=sc.s();
        String s1="";
        String s2="";
        int start=0;
        if(n==1)
        {
            if(s.equals("1"))
            System.out.println("YES");
            else
            System.out.println("NO");
        }
        else if(n==2)
        {
            if(s.equals("10")||s.equals("01"))
            System.out.println("YES");
            else
            System.out.println("NO");
        }
        else
        {
            if(s.indexOf("000")>=0||s.indexOf("11")>=0||s.substring(s.length()-2).equals("00")||s.substring(0,2).equals("00"))
            {
                System.out.println("NO");
                System.exit(0);
            }
            System.out.println("YES");
        }
    }
}

import java.util.*;
import java.io.*;

public class Solution1 {

    private void solve() throws IOException {
        int n = in.nextInt();

        String pas = in.next();
        if (n == 1) {
            if (pas.equals("0")) {
                System.out.println("No");
                return;
            }
            else {
                System.out.println("Yes");

                return;
            }
        }
        int max = 0;
        for (int i = 0; i < n; i++) {
            if (pas.charAt(i) == '1') {
                if (i > 0 && pas.charAt(i - 1) == '1') {
                    System.out.println("No");
                    return;
                }
                if (i < n - 1 && pas.charAt(i + 1) == '1') {
                    System.out.println("No");
                    return;
                }
            }
            else {
                if (i == 0) {
                    if (pas.charAt(i + 1) == '0') {
                        System.out.println("No");
                        return;
                    }
                }
                if (i == n - 1) {
                    if (pas.charAt(i - 1) == '0') {
                        System.out.println("No");
                        return;
                    }
                }
                if (i > 0 && i < n - 1 && pas.charAt(i + 1) == '0' && pas.charAt(i - 1) == '0') {
                    System.out.println("No");
                    return;
                }
                max++;
            }
        }
        if (max == n){
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }

    private PrintWriter out;
    private MyScanner in;

    private void run() throws IOException {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    private class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public MyScanner() throws IOException {
            this.br = new BufferedReader(new InputStreamReader(System.in));
        }

        public MyScanner(String fileTitle) throws IOException {
            this.br = new BufferedReader(new FileReader(fileTitle));
        }

        public String nextLine() throws IOException {
            String s = br.readLine();
            return s == null ? "-1" : s;
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return "-1";
                }
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public Integer nextInt() throws IOException {
            return Integer.parseInt(this.next());
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(this.next());
        }

        public Double nextDouble() throws IOException {
            return Double.parseDouble(this.next());
        }

        public void close() throws IOException {
            this.br.close();
        }
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Solution1().run();
    }
}

import java.util.Scanner;

public class Row982A {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        if (s.length() == 1){
            if (s.compareTo("1") != 0){
                System.out.println("No");
                return;
            }
        }
        int c = 0;
        for (int i = 0; i <s.length() - 1 ; i++) {
            if (c > 1){
                System.out.println("No");
                return;
            }
            int f = s.charAt(i) - '0';
            int ff = s.charAt(i + 1) -'0';
            if (f * ff != 0){
                System.out.println("No");
                return;
            }else {
                if (f == 0 && ff == 0){
                    c++;
                } else if (f + ff == 1){
                    c = 0;
                }
            }
            if (i == n -2 && f + ff == 0){
                System.out.println("No");
                return;
            }
            if (i == 0 && f + ff == 0){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");

    }
}

import java.util.*;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();
		String ans = "Yes";
		if (n==1) {
			if (s.charAt(0)=='0')
				ans = "No";
			else
				ans="Yes";
		}else {
			int index =0;
			while(index<n && s.charAt(index)=='0') {
				index++;
			}

			if (index>=2)
				ans="No";
			//System.out.println(index);
			int index1 = n-1;
			while(index1>=0 && s.charAt(index1)=='0') {
				index1--;
			}

			if (n-index1-1>1) {
				ans="No";
			}

			if (!ans.equals("No")) {

				for (int i =0;i<n-1;i++) {
					if (s.charAt(i)=='1') {
						int count =0;
						int j = i+1;
						for (j=i+1;j<n;j++) {
							if (s.charAt(j)=='0')
								count++;
							else
								break;
						}
						if (count>2)
						{
							ans="No";
							break;
						}else if (count==0 && j-i==1) {
							ans="No";
						}
					}
				}

			}

		}
		System.out.println(ans);

		sc.close();

	}

}

import java.util.Scanner;

public class row {

    public static void print(int line) {
        System.out.println(line+"");
    }

    public static void print(String line) {
        System.out.println(line);
    }

    public static void main(String[] args) {
	    // write your code here
        Scanner in  = new Scanner(System.in);
        int num_chair = in.nextInt();
        String seating = in.next();
        seating = seating.replace("\n", "");

        if (num_chair == 1) {
            if (seating.equals("0")) {
                print("No");
            }
            else {
                print("Yes");
            }
            return;
        }

        if (num_chair == 2) {
            if (seating.equals("00") || seating.equals("11")) {
                print("No");
            }
            else {
                print("Yes");
            }
            return;
        }

        int size = seating.length(), count = 0;

        if ((seating.charAt(0) == '0' && seating.charAt(1) == '0') || (seating.charAt(size - 1) == '0' && seating.charAt(size - 2) == '0')) {
            print("No");
            return;
        }

        for (int i = 1; i < size; i++) {
            if (seating.charAt(i) == '0') {
                count++;
                if (count >= 3) {
                    print("No");
                    return;
                }
            }
            else if (seating.charAt(i - 1) == '1') {
                print("No");
                return;
            }
            else {
                count = 0;
            }
        }
        print("Yes");
    }
}

import java.util.Scanner;

public class Test{
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int total = input.nextInt();
        input.nextLine();
        String line = input.nextLine();
        char[] opa = line.toCharArray();
        boolean result = true;

        for (int i = 0; i < opa.length; i++){
            //System.out.println(opa[i]);
            if (opa[i] == '0'){
                if (i == 0){
                    if (opa.length == 1 || opa[i + 1] == '0'){
                        result = false;
                    }

                } else if (i <= opa.length - 3 && opa[i + 1] == '0' && opa[i + 2] == '0'){
                    result = false;
                } else if (i == opa.length - 2 && opa[i + 1] == '0'){
                    result = false;
                }
            } else {
                //System.out.println("check positon " + i);
                if (i != opa.length - 1 && opa[i + 1] == '1'){
                    result = false;
                }
            }
        }

        System.out.println(result ? "Yes" : "No");
    }

}

import java.io.*;
import java.util.*;
public class Solution{
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        br.readLine();
        String str=br.readLine();
        if((str.equals("0"))||(str.length()>1&&(str.contains("11")||str.contains("000")||(str.charAt(str.length()-1)=='0'&&str.charAt(str.length()-2)=='0')||str.substring(0,2).equals("00")))){
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

import java.util.*;
public class codeforces {
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        char[] arr=s.toCharArray();
        int length=arr.length;
        boolean check=true;

        if(n==1)
        {
            if(arr[0]=='0')
                System.out.println("No");
            else
                System.out.println("Yes");

            return;

        }
        for(int i=0;i<=length-2;i++)
        {
            if(arr[i]=='1' && arr[i+1]=='1') {
                check = false;
                break;
            }

        }

        for(int i=0;i<=length-1;i++)
        {
            if(i==0)
            {
                if(arr[i]=='0' && arr[i+1]=='0'){
                    check=false;
                    break;
                }
            }
            else if(i==length-1)
            {
                if(arr[i]=='0' && arr[i-1]=='0')
                    check=false;
            }
            else if(arr[i]=='0' && arr[i-1]=='0' && arr[i+1]=='0') {
                check = false;
                break;
            }
        }

        if(check)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}

/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Code1
{

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int n = in.nextInt();
		char[] s = in.nextLine().toCharArray();

		if(n==1)
		{
			if(s[0]=='1')
				pw.println("Yes");
			else
				pw.print("No");
		}
		else
		{
		boolean flag = true;
		for(int i=0;i<n-1;i++)
		{
			if(s[i]=='1' && s[i+1]=='1')
				flag = false;
		}

		if(flag)
		{
			for(int i=0;i<n-2;i++)
			{
				if(s[i]=='0' && s[i+1]=='0' && s[i+2]=='0')
					flag = false;
			}
			if((s[0]=='0' && s[1]=='0') || (s[n-2]=='0' && s[n-1]=='0'))
				flag = false;
		}

		if(flag)
			pw.println("Yes");
		else
			pw.println("No");
		}
		pw.flush();
		pw.close();
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}

import java.util.Scanner;

/**
 *
 * @author moham
 */
public class NewMain25 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       Scanner input =new Scanner(System.in);
        int n = input.nextInt();
        String cha = input.next();
        boolean ans = true;
        if(n>1){
        for(int i=1;i<n;i++){
            if(cha.charAt(i)=='1'){
                if(i+1<n){
                    if(cha.charAt(i+1)!='0'||cha.charAt(i-1)!='0'){
                        ans=false;
                        break;
                    }
                }else{
                    if(cha.charAt(i-1)!='0'){
                        ans=false;
                        break;
                    }
                }
            }else{
                if(i+1<n&&i!=1){
                    if(cha.charAt(i+1)=='0'&&cha.charAt(i-1)=='0'){
                        ans=false;
                        break;
                    }
                }else{
                    if(cha.charAt(i-1)=='0'){
                        ans=false;
                        break;
                    }
                }
            }
        }
        System.out.println((ans)?"Yes":"No");
        }else{
            System.out.println((cha.charAt(0)=='1')?"Yes":"No");
        }
    }
}

import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String bin=sc.next();
        char check=0;
        int flag=0;
        int count=0;
        for(int i=0;i<n;i++)
        {
            char dummy=bin.charAt(i);
            if(n==1 && dummy=='0')
            {
                flag=1;
            }
            else if(dummy=='0' && check==1)
            {
                check=0;
                count++;
            }
            else if(dummy=='0' && check==0)
            {
                count++;
                if(count>=3)
                {
                    flag=1;
                    break;
                }
                else if ( (count==2 ) && (i==1 || i==n-1) )
                {
                    flag=1;
                    break;
                }
            }
            else
            {
                count=0;
                check=1;
            }
            if(i!=n-1 && dummy=='1' && bin.charAt(i+1)=='1')
            {
                flag=1;
                break;
            }
        }
        if(flag==0)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class Main {
	public static void main(String[] args)throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int flag = 0;
		char a[] = new char[n];
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s;
		s = sc.next();
		for(int i = 0 ; i < n ; i++)
		{
			char c = s.charAt(i);
			a[i]=c;
		}
		if(n == 1)
		{
			if(a[0] == '0')
			{
				System.out.println("No");
				System.exit(0);
			}
			else
			{
				System.out.println("Yes");
				System.exit(0);
			}
		}
		for(int i = 0 ; i < n ; i++)
		{
			if(i == 0)
			{
				if(a[0] == '1')
				{
					if(a[1] == '1')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
				else
				{
					if(a[1] == '0')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
			}
			else if(i == (n -1))
			{
				if(a[i] == '1')
				{
					if(a[i - 1] == '1')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
				else
				{
					if(a[i - 1] == '0')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
			}
			else
			{
				if(a[i] == '1')
				{
					if(a[i + 1] == '1' || a[i - 1] == '1')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
				else
				{
					if(a[i + 1] == '0' && a[i - 1] == '0')
					{
						System.out.println("No");
						System.exit(0);
					}
				}
			}
		}
		System.out.println("Yes");
		sc.close();
	}
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		if(n==1){
		    if(s.equals("1")){System.out.println("Yes");}
		    else{System.out.println("No");}
		}
		else if(n==2){
		    if(s.equals("10") || s.equals("01")){
		        System.out.println("Yes");
		    }else{
		        System.out.println("No");
		    }
		}

		else{
		    int r=0;
		    int count0=0,count1=0;
		    for(int i=0;i<s.length()-1;i++){
		        if(s.charAt(i)==s.charAt(i+1) && s.charAt(i)=='0'){
		            count0=count0+2;
		        }
		        else if(s.charAt(i)== s.charAt(i+1) && s.charAt(i)=='1'){count1=count1+2;}

		        else{count1=0;count0=0;}
		        if(count0>=2 && i==0){r=1;break;}
		        else if(count1==2){r=1;break;}
		        else if(count0>=3){r=1;break;}
		        else if(count0>=2 && i==(n-2)){r=1;break;}
		    }
		    if(r==1){System.out.println("No");}
		    else{System.out.println("Yes");}

		}

	}
}

import java.util.Scanner;

public class ProblemA {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.next();
        boolean invalid = false;
        for (int i = 0 ; i < n ; i++){
            char current = str.charAt(i);

            if( current == '1' && (i+1 <= str.length()-1 && str.charAt(i+1) =='1')){
                invalid = true;
            }
            else if(current == '0'){
                invalid = (i-1 >= 0? (str.charAt(i-1) =='0') : true );
                invalid &= (i+1 <= str.length()-1? (str.charAt(i+1) =='0') : true );
            }

            if(invalid)
                break;

        }

        if(!invalid)
            System.out.println("Yes");
        else System.out.println("No");
    }
}

import java.util.ArrayList;
import java.util.Scanner;

public class cf
{

	static ArrayList[] adj;
	static int[] visited;
	static int ans = 0;

	public static void main(String[] args)
	{

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		in.nextLine();
		String s = in.nextLine();
		int ans = 0;

		for (int i = 1; i < n; i++)
		{
			if (s.charAt(i) == '1' && s.charAt(i - 1) == '1')
			{
				ans = 1;
				break;
			}
		}

		for (int i = 0; i < n; i++)
		{
			if (s.charAt(i) == '0')
			{
				if(n == 1){
					ans = 1;
					break;
				}

				if (i == 0 && i + 1 < n && s.charAt(i + 1) == '0')
				{
					ans = 1;
					break;
				}
				if (i == n - 1 && i - 1 >= 0 && s.charAt(i - 1) == '0')
				{
					ans = 1;
					break;
				}

				if (i != 0 && i != n - 1)
				{
					if (s.charAt(i - 1) == '0' && s.charAt(i + 1) == '0')
					{
						ans = 1;
						break;
					}
				}
			}
		}

		if (ans == 1)
		{
			System.out.println("No");
		} else
		{
			System.out.println("Yes");
		}

	}

	public static int dfs(int i)
	{
		if (visited[i] == 1)
		{
			return 0;
		}

		visited[i] = 1;

		int sum = 1;

		for (int j = 0; j < adj[i].size(); j++)
		{
			sum += (int) dfs((int) adj[i].get(j));
		}

		if (sum % 2 == 0)
		{
			ans++;
			return 0;
		}

		return sum;
	}

}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        while(cin.hasNext()){
            int n = cin.nextInt();
            String s = cin.next();
            int cnt =s.charAt(0)=='0'?1:0;
            int fg = 0;
            if(n>=2 && (s.charAt(0)==s.charAt(1)&&s.charAt(0)=='0'||s.charAt(s.length()-2)==s.charAt(s.length()-1)&&s.charAt(s.length()-1)=='0')){
                System.out.println("No");
                continue;
            }
            for(int i = 1;i < s.length();i++){
                if(s.charAt(i)=='1'&&s.charAt(i)==s.charAt(i-1)||cnt>=3){
                    fg = 1;
                    break;
                }
                if(s.charAt(i)=='0'){
                    cnt++;
                }
                else {
                    cnt=0;
                }
            }
            if(n==1){
                if(s.charAt(0)=='1'){
                    System.out.println("Yes");
                }
                else{

                    System.out.println("No");
                }
                continue;
            }
            if(fg == 1){
                System.out.println("No");
            }
            else{
                System.out.println("Yes");
            }
        }
    }
}

import java.util.Scanner;
public class Codeforces {
 public static void main(String args[]) {
	 Scanner sc = new Scanner(System.in);
	 int n = sc.nextInt();
	 int ctr=0;
	 int flag=0;
	 String s = sc.next();
	 for(int i=0;i<s.length();i++)
	 {
		 if(i>0&&s.charAt(i)=='1'&&s.charAt(i-1)=='1')flag=1;
		 if(i==1&&s.charAt(i-1)=='0'&&s.charAt(i)=='0')flag=1;
		 if(i==s.length()-1&&i>0&&s.charAt(i-1)=='0'&&s.charAt(i)=='0')flag=1;
		if(i>0&&i<s.length()-1&&s.charAt(i-1)=='0'&&s.charAt(i)=='0'&&s.charAt(i+1)=='0')flag=1;

	 }
	 if(s.length()==1&&s.charAt(0)=='0')flag=1;
	 if(flag==1)
	 System.out.println("No");
	 else System.out.println("Yes");

 }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class a{
    public static void main(String[] args)throws Exception{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          int n = Integer.parseInt(br.readLine());
	     String s = br.readLine();
     	System.out.println(s.contains("11") || s.contains("000")|| s.startsWith("00") || s.endsWith("00") || s.equals("0")?"No":"Yes");
    }
}

import java.awt.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner S=new Scanner(System.in);
		int n=S.nextInt();
		String s=S.next();

		boolean f=false;
		for (int i = 0; i < n-1; i++) {
			if(s.charAt(i)=='1'&&s.charAt(i+1)=='1') {System.out.println("NO");System.exit(0);}
		}
		for (int i = 0; i < n; i++) {
			if(s.charAt(i)!='1') {
				StringBuilder help=new StringBuilder(s);
				help.setCharAt(i, '1');
				boolean ter=true;
				for (int j = 0; j < n-1; j++) {
					if(help.charAt(j)=='1'&&help.charAt(j+1)=='1') {
						ter=false;
					}
				}
				if(ter) {System.out.println("NO");System.exit(0);}
				}
		}
		System.out.println("YES");
	}

}

import java.io.*;
public class row
{
 public static void main(String args[])throws IOException
 {
  InputStreamReader read=new InputStreamReader(System.in);
  BufferedReader in=new BufferedReader(read);
  int i,c,n;
  c=1;
  char p,q;
  String s,a;
  a="YES";
  n=Integer.parseInt(in.readLine());
  s=in.readLine();
  for(i=0;i<(n-1);i++)
  {
   p=s.charAt(i);
   q=s.charAt(i+1);
   if(p==q && p=='0')
   c++;
   else if(p==q && p=='1')
   a="NO";
   else
   c=1;
   if(c>2)
   a="NO";
  }
  if(s.equals("0") || s.equals("00"))
  a="NO";
  if(n>=2 && (s.substring(0,2).equals("00") || s.substring(n-2).equals("00")))
  a="NO";
  System.out.println(a);
 }
}

import java.io.*;
import java.util.*;
import java.math.*;

public class Main implements Runnable{

	public void solve() throws Exception{
		int n=ni();
		String s=n();
		s=s+"00";
		int pos=s.charAt(0)=='1' ? 0 : -2;
		for( int i=0;i<s.length();i++ ){
			if( i-pos>3 || ( i>0 &&  s.charAt(i)=='1' && s.charAt(i-1)=='1' )){ pn("No"); return; }
			if( s.charAt(i)=='1' )pos=i;
		}pn( pos!=-2? "Yes":"No" );
	}

	public long[]la( int N ) throws Exception{
    	long[]a=new long[N];
    	for( int i=0;i<N;i++ )a[i]=nl();
    	return a;
    }

    public int[] ia(int N) throws Exception{
        int[] a = new int[N];
        for(int i = 0; i<N; i++)a[i] = ni();
        return a;
    }

	public int ni() throws IOException {
		return Integer.parseInt(n());
	}
	public long nl() throws IOException {
		return Long.parseLong(n());
	}

    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

	public String n() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public String nln() throws IOException {
		tok = new StringTokenizer("");
		return in.readLine();
	}

	public boolean hasNext() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null) {
				return false;
			}
			tok = new StringTokenizer(s);
		}
		return true;
	}

	public static void main(String args[]) {
		new Thread(null, new Main(), "Main", 1 << 28).start();
	}

	public BufferedReader in;
	public PrintWriter out;
	public StringTokenizer tok;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			Locale.setDefault(Locale.US);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			java.lang.System.exit(1);
		}
	}
}

/******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner file = new Scanner(System.in);
        int times = file.nextInt();
        String s = file.next();
        if (times == 1) System.out.println(s.equals("1") ? "Yes" : "No");
        else {
        boolean b = true;
        for (int i = 0; i < times - 1; i++) {
            if (s.charAt(i) == '1' && s.charAt(i + 1) == '1') {
                b = false;
                break;
            }
        }
        if (times >= 2 && s.substring(0, 2).equals("00")) b = false;
        int count = 0;
        for (int i = 0; i < times; i++) {
            if (s.charAt(i) == '0') {
                count++;
            }
            else count = 0;
            if (count >= 3) {
                b = false;
                break;
            }
        }
        if (count >= 2) b = false;
        System.out.println(b ? "Yes" : "No");
        }
	}
}

import java.util.*;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();
		String ans = "Yes";
		if (n==1) {
			if (s.charAt(0)=='0')
				ans = "No";
			else
				ans="Yes";
		}else {
			int index =0;
			while(index<n && s.charAt(index)=='0') {
				index++;
			}

			if (index>=2)
				ans="No";
			//System.out.println(index);
			int index1 = n-1;
			while(index1>=0 && s.charAt(index1)=='0') {
				index1--;
			}

			if (n-index1-1>1) {
				ans="No";
			}

			if (!ans.equals("No")) {

				for (int i =0;i<n-1;i++) {
					if (s.charAt(i)=='1') {
						int count =0;
						int j = i+1;
						for (j=i+1;j<n;j++) {
							if (s.charAt(j)=='0')
								count++;
							else
								break;
						}
						if (count>2)
						{
							ans="No";
							break;
						}else if (count==0 && j-i==1) {
							ans="No";
						}
					}
				}

			}

		}
		System.out.println(ans);

		sc.close();

	}

}

//cf484v3
import java.util.Scanner;
public class cf484v3 {

   public static boolean maximal(int numChairs, String seating) {
      if(seating.length() == 1 && seating.equals("1")) {
         return true;
      }else if(seating.length() == 1) {
         return false;
      }

      int fullCount = 0; //counter variable for occupied seats
      //System.out.println(seating);
      for(int i = 0; i < seating.length(); i++) {
         if(seating.charAt(i) == '1') {
            fullCount++;
         }
      }
      //System.out.println("fullCount =" + fullCount);
      //check if any two adjacent seats are full
      for(int i = 0; i < seating.length() - 1; i++) {
         if(seating.charAt(i) == '1' && seating.charAt(i + 1) == '1') {
            return false;
         }

      }

      //check if there are ever 2 0s in row
      for(int i = 0; i < seating.length() - 2; i++) {
         if(seating.charAt(i) == '0' && seating.charAt(i + 1) == '0'
            && seating.charAt(i + 2) == '0') {
               return false;
         }
      }

      //end chars
      if((seating.charAt(0) == '0' && seating.charAt(1) == '0')
         || (seating.charAt(seating.length() - 1) == '0'
            && seating.charAt(seating.length() - 2) == '0')) {
               return false;
      }
      return true;

   } //end of helper method

   public static void main(String[] args) {
      Scanner kb = new Scanner(System.in);
      int numChairs = kb.nextInt();
      //int seating = kb.nextInt();
      String seatings = kb.next();
      if(maximal(numChairs, seatings)) {
         System.out.print("Yes");
      }else{
         System.out.print("No");
      }
   } //end of main
}

import java.io.*;
import java.text.ParseException;
import java.util.*;

public class Main {

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static StringBuilder sb = new StringBuilder();
    private static final int mod = (int)1e9 + 7;

    static int[] inputArray() throws IOException {
        int n = Integer.parseInt(br.readLine());
        int[] a = new int[n];
        st = new StringTokenizer(br.readLine());
        for(int i = 0 ; i < n ; i++) {
            a[i] = Integer.parseInt(st.nextToken());
        }
        return a;
    }

    static long[][] inputPoints(int n) throws IOException {
        long[][] a = new long[n][3];
        for(int i = 0 ; i < n ;i++) {
            st = new StringTokenizer(br.readLine());
            a[i][0] = Long.parseLong(st.nextToken());
            a[i][1] = Long.parseLong(st.nextToken());
            a[i][2] = i;
        }
        return a;
    }

    public static void main(String[] args) throws IOException, ParseException {
        int n = Integer.parseInt(br.readLine());
        String s = br.readLine();
        boolean possible = true;
        for(int i = 0 ; i < n - 1 ; i++) {
            if(i <= n - 3) {
                if (s.charAt(i) == '0' && s.charAt(i + 1) == '0' && s.charAt(i + 2) == '0') {
                    possible = false;
                    break;
                }
            }
            if(s.charAt(i) == '1' && s.charAt(i+1) == '1') {
                possible = false;
                break;
            }
        }
        if(possible) {
            System.out.println("YES");
        }
        else {
            System.out.println("NO");
        }
    }

    private static int Code(int[] a) {
        int n = a.length;
        int freq[] = new int[n];
        for (int i = 0; i < n; i++) {
            freq[a[i]]++;
        }
        ArrayList<Integer> unique = new ArrayList<>();
        for(int i = 0 ; i < n ;i++) {
            if(freq[i] > 0) {
                unique.add(i);
            }
        }
        for(int element : unique) {
            for(int i = 1 ; i <= freq[element] ; i++) {

            }
        }
        return 0;
    }

    private static long[] createPreSum(long[] dp , int n) {
        long[] preSum = new long[n+1];
        preSum[0] = 0;
        for(int i = 1 ; i <= n ; i++) {
            preSum[i] = (preSum[i-1] + dp[i]) % mod;
        }
        return preSum;
    }

    static long[] createDP(int k , int n) {
        long[] dp = new long[n+1];
        dp[0] = 1;
        for(int i = 1 ; i <= n ; i++) {
            if(i >= k) {
                dp[i] = (dp[i] + dp[i-k]) % mod;
            }
            dp[i] = (dp[i] + dp[i-1]) % mod;
        }
        return dp;
    }

}

import java.util.Scanner;

public class Test {
	static int[] x;
	static int[] y;
	static int n1;
	static int[] masterp;
	static long[][] ss;

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		String string = s.next();
		char last = 'a';
		boolean chered = true;
		boolean is1 = false;
		for(int i = 1; i < string.length(); i ++){
			if(string.charAt(i-1) == '0' && string.charAt(i)=='0'){
				chered = false;
			}
			else if(string.charAt(i-1) == '1' && string.charAt(i)=='1'){
				is1 = true;
				chered = false;
			}
		}
		if(is1 == true){
			System.out.println("No");
		}
		else if(chered == false) {
			for(int i = 2; i < 1000; i += 2){
				if(string.contains(repeat(i, "0"))){
					System.out.println("No");
				}
				else if(string.contains(repeat(i, "1"))){
					System.out.println("No");
				}
			}
		}
		else if(chered){
			System.out.println("Yes");
		}
	}

	public static void fill(int a, int b, int w) {
		ss[a][b] = w;
	}
	public static String repeat(int count, String with) {
	    return new String(new char[count]).replace("\0", with);
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
public class Codechef{
    static FR in;
    public static void main(String[] args)throws Exception{
    	in =new FR();
    	int n=ni();
    	String s =n();
    	if( n==1 ){ pn( s.charAt(0)=='0' ? "No" : "Yes" );  return; }
    	int pos=-1;
    	for( int i=0;i<n;i++ ){
    		if( s.charAt(i)=='1' ){ if( pos<i-3 || pos==i-1 ){ pn("No " ); return; } pos=i; }
    	}
    	pn( "Yes" );
    }

    static long[]la( int N ){
    	long[]a=new long[N];
    	for( int i=0;i<N;i++ )a[i]=nl();
    	return a;
    }

    static int[] ia(int N){
        int[] a = new int[N];
        for(int i = 0; i<N; i++)a[i] = ni();
        return a;
    }

    static class FR{
        BufferedReader br;
        StringTokenizer st;
        public FR(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                e.printStackTrace();
            }
            return str;
        }
    }

    static void p(Object o){
        System.out.print(o);
    }

    static void pn(Object o){
        System.out.println(o);
    }

    static String n(){
        return in.next();
    }

    static String nln(){
        return in.nextLine();
    }

    static int ni(){
        return Integer.parseInt(in.next());
    }

    static long nl(){
        return Long.parseLong(in.next());
    }
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.TreeMap;

public class Maze {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int nn=s.nextInt();
		String str=s.next();
		//String str=Integer.toString(n);
		boolean flag=false;
		int count=0;
		boolean flaga=false;
		for(int i=0;i<nn;i++){
			if(str.charAt(i)=='1'&&flag){
				flaga=true;
				break;
			}
			if(str.charAt(i)=='1'){
				flag=true;
				count=0;
			}
			else{
				count++;
				flag=false;
			}
			if(count>1&&(i==1||i==nn-2)){
				flaga=true;
				break;
			}
			if(count>2){
				flaga=true;
				break;
			}

		}
	//	System.out.println(num1+" "+num2);
		if(flaga){
			System.out.println("No");
		}
		else{
			System.out.println("Yes");
		}
	}
}

import java.util.Scanner;
public class CodeTest {
     static Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {
	   int nint=sc.nextInt();
	   String n=sc.nextLine();
	   String dOne="11";
	   String sl="00";
	   String check="000";
	   if(n.indexOf(check)!=(-1) || n=="1011" || n.indexOf(sl)==n.length()-2)  {
		  System.out.println("No");
	  }else {
	   System.out.println("Yes");
	   }

	}
}

import java.util.Scanner;

/**
 *
 * @author moham
 */
public class NewMain25 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        int n = input.nextInt();
        String cha = input.next();
        if(n>1){
        char odd = cha.charAt(0);
        char even = cha.charAt(1);
        boolean ans = true;
        if(odd == even){
            ans = false;
        }else{
            for(int i=2;i<n;i++){
            if(i%2==0){
                if(cha.charAt(i)!=odd){
                    ans = false;
                    break;
                }
            }else{
                if(cha.charAt(i)!=even){
                    ans = false;
                    break;
                }
            }
            }
        }
        System.out.println((ans)?"Yes":"No");
        }else{
            System.out.println("Yes");
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class RowSingleFile {

	private static boolean check(int seatQty, String seatOccupancy) {
		char prevSeat = seatOccupancy.charAt(0);
        boolean isMax = true;
        if(seatQty==1 && prevSeat == '0') return false;
        for(int i=1; i<seatQty; i++) {

			if (seatOccupancy.charAt(i) == prevSeat) {
				isMax = false;
        		break;
        	}
			prevSeat = seatOccupancy.charAt(i);
        }
        return isMax;
	}

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
		    String seatQty = scanner.nextLine();
		    String seatOccupation = scanner.next();
		    boolean rowMaximal = check(Integer.parseInt(seatQty.trim()),seatOccupation);
	        System.out.println(rowMaximal?"Yes":"No");
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {

	static int n ;

	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();

		char [] s  = sc.next().toCharArray();
		boolean f = true;
		boolean f2 = true;
		for(int i = 0 ; i<n-1 ; i++) {
			f2 &=!(s[i] == '0'  && s[i+1]=='0');
		}

		for(int i = 0 ; i<n ; i++) {
			char [] b = s.clone();
			if(b[i] == '0') continue;
			b[i] = '0' ;

			boolean f3 = false;
			for(int  j= 0 ; j<n-1 ; j++) {
				f3 |= (b[j] == '0'  && b[j+1]=='0');
//				System.out.println((b[j] == 0  && b[j+1]==0));
			}
			f&=f3;
		}

		System.out.println((n!=1 ||f2 && f)? "Yes":"No");

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream fileReader) {
			br = new BufferedReader(new InputStreamReader(fileReader));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        if (n==1){
            System.out.println("Yes");
            return;
        }
        if (n==2){
            if (s.charAt(0)==s.charAt(1)){
                System.out.println("No");
            }else {
                System.out.println("Yes");
            }
            return;
        }

        for (int i=0;i<n-1;i++ ){
            if (s.charAt(i)=='1'&&s.charAt(i+1)=='1'){
                System.out.println("No");
                return;
            }
        }
        for (int i=1;i<n-1;i++){
            if (s.charAt(i)==s.charAt(i-1)&&s.charAt(i)==s.charAt(i+1)){
                System.out.println("No");
                return;
            }
        }
        if (s.charAt(0)=='0'&&s.charAt(1)=='0'){
            System.out.println("No");
            return;
        }
        if (s.charAt(n-1)=='0'&&s.charAt(n-2)=='0'){
            System.out.println("No");
            return;
        }
        int sum = 0;
        for (int i=0;i<n;i++){
            if (s.charAt(i)=='1'){
                sum++;
            }
        }
        if (n%2==0){
            n/=2;
        }else {
            n=n/2+1;
        }
        if (sum==n){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }

    }
}

import java.util.Scanner;

public class cf
{

	public static void main(String[] args)
	{

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		in.nextLine();
		String s = in.nextLine();

		int count = 0;
		int ans = 0;

		if(s.charAt(0) == 0){
			count = 1;
		}

		for(int i = 1;i<n;i++){
			if(s.charAt(i) == '1' && s.charAt(i-1) == '1'){
				ans = 1;
				break;
			}else{
				count++;
			}
		}

		if(count == Math.ceil(n/2)){
			ans = 0;
		}else{
			ans = 1;
		}

		if(ans == 1){
				System.out.println("no");
		}else{
			System.out.println("Yes");
		}
	}

}

import java.io.*;
import java.util.*;
public class row
{
    public static void main (String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String st = br.readLine();
        char[] chairs = st.toCharArray();
        int counter = 0;
        boolean check;
        if (n == 1 && chairs[0] == '1')
        {
            System.out.println("Yes");
            System.exit(0);
        }
        else if (n == 1 && chairs[0] == '0')
        {
            System.out.println("No");
            System.exit(0);
        }
        if (n == 2 && chairs[0] == '0' && chairs[1] == '0')
        {
            System.out.println("No");
            System.exit(0);
        }
        if (chairs[0] == '1')
        {
            check = true;
        }
        else
        {
            check = false;
        }
        for (int i = 1 ; i < n ; i++)
        {
            if (counter == 2 && i == 3)
            {
                System.out.println("No");
                System.exit(0);
            }
            if (counter > 2 && i == n)
            {
                System.out.println("No");
                System.exit(0);
            }
            if (chairs[i] == '1' && check == false && counter <= 2)
            {
                check = true;
                counter = 0;
            }
            else if (chairs[i] == '0' && check == true)
            {
                check = false;
                counter++;
            }
            else
            {
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("Yes");
        System.exit(0);
    }
}

import java.io.*;
import java.math.BigInteger;
import java.util.*;

@SuppressWarnings("unused")
public class Practice
{
	private static InputStream		stream;
	private static byte[]			buf	= new byte[1024];
	private static int				curChar;
	private static int				numChars;
	private static SpaceCharFilter	filter;
	private static PrintWriter		pw;
	private static long				mod	= 1000000000 + 7;

	private static void soln()
	{
		int N = nextInt();

		String seating = nextLine();

		if (N == 1)
		{
			pw.println("YES");
			return;
		}

		for (int i = 1; i < N - 1; i++)
		{
			if (seating.charAt(i) == '1')
			{
				if (seating.charAt(i - 1) == '1' || seating.charAt(i + 1) == '1')
				{
					pw.println("NO");
					return;
				}
			}
			else
			{
				if (seating.charAt(i - 1) == '0' && seating.charAt(i + 1) == '0')
				{
					pw.println("NO");
					return;
				}
			}
		}

		if (seating.charAt(N - 1) == seating.charAt(N - 2))
			pw.println("NO");
		else
			pw.println("YES");
	}

	public static class Segment
	{
		private int[]		tree;
		private boolean[]	lazy;
		private int			size;
		private int			n;

		private class node
		{
			private int	a;
			private int	b;
			private int	c;

			public node(int x, int y, int z)
			{
				a = x;
				b = y;
				c = z;
			}
		}

		public Segment(int n)
		{
			// this.base=arr;
			int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
			size = 2 * (int) Math.pow(2, x) - 1;
			tree = new int[size];
			lazy = new boolean[size];
			this.n = n;
			build(0, 0, n - 1);
		}

		public void build(int id, int l, int r)
		{
			if (l == r)
			{
				return;
			}
			int mid = (l + r) / 2;
			build(2 * id + 1, l, mid);
			build(2 * id + 2, mid + 1, r);
			tree[id] = tree[2 * id + 1] + tree[2 * id + 2];
		}

		public int query(int l, int r)
		{
			return queryUtil(l, r, 0, 0, n - 1);
		}

		private int queryUtil(int x, int y, int id, int l, int r)
		{
			if (l > y || x > r)
				return 0;
			if (x <= l && r <= y)
			{
				// if(!lazy[id])
				return tree[id];
				// else
				// return tree[id][0];
			}
			int mid = l + (r - l) / 2;
			shift(id);
			return queryUtil(x, y, 2 * id + 1, l, mid) + queryUtil(x, y, 2 * id + 2, mid + 1, r);
		}

		public void update(int x, int y, int colour, int id, int l, int r)
		{
			// System.out.println(l+" "+r+" "+x);
			if (x > r || y < l)
				return;
			if (x <= l && r <= y)
			{

				return;
			}
			int mid = l + (r - l) / 2;
			shift(id);
			update(x, y, colour, 2 * id + 1, l, mid);
			update(x, y, colour, 2 * id + 2, mid + 1, r);
			tree[id] = tree[2 * id + 1] + tree[2 * id + 2];
		}

		public void shift(int id)
		{

		}

	}

	public static void fft(double[] a, double[] b, boolean invert)
	{
		int count = a.length;
		for (int i = 1, j = 0; i < count; i++)
		{
			int bit = count >> 1;
			for (; j >= bit; bit >>= 1)
				j -= bit;
			j += bit;
			if (i < j)
			{
				double temp = a[i];
				a[i] = a[j];
				a[j] = temp;
				temp = b[i];
				b[i] = b[j];
				b[j] = temp;
			}
		}
		for (int len = 2; len <= count; len <<= 1)
		{
			int halfLen = len >> 1;
			double angle = 2 * Math.PI / len;
			if (invert)
				angle = -angle;
			double wLenA = Math.cos(angle), wLenB = Math.sin(angle);
			for (int i = 0; i < count; i += len)
			{
				double wA = 1, wB = 0;
				for (int j = 0; j < halfLen; j++)
				{
					double uA = a[i + j], uB = b[i + j];
					double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
					double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
					a[i + j] = uA + vA;
					b[i + j] = uB + vB;
					a[i + j + halfLen] = uA - vA;
					b[i + j + halfLen] = uB - vB;
					double nextWA = wA * wLenA - wB * wLenB;
					wB = wA * wLenB + wB * wLenA;
					wA = nextWA;
				}
			}
		}
		if (invert)
		{
			for (int i = 0; i < count; i++)
			{
				a[i] /= count;
				b[i] /= count;
			}
		}
	}

	static void multiply(long[][] a, long[][] b, long m)
	{
		int n = a.length;
		long[][] mul = new long[n][n];
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				mul[i][j] = 0;
				for (int k = 0; k < n; k++)
					mul[i][j] = (mul[i][j] + (a[i][k] * b[k][j]) % m) % m;
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				a[i][j] = mul[i][j];
	}

	private static long pow(long a, long b, long c)
	{
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}

	private static long gcd(long n, long l)
	{
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}

	public static void main(String[] args) throws Exception
	{
		// new Thread(null, new Runnable()
		// {
		// @Override
		// public void run()
		// {
		// /*try {
		// InputReader(new
		// FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in"));
		// } catch (FileNotFoundException e) { // TODO Auto-generated catch
		// block
		// e.printStackTrace();
		// } */
		// InputReader(System.in);
		// pw = new PrintWriter(System.out);
		// /*try {
		// pw=new PrintWriter(new
		// FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
		// } catch (FileNotFoundException e) { // TODO Auto-generated catch
		// block
		// e.printStackTrace();
		// }*/
		// soln();
		// pw.close();
		// }
		// }, "1", 1 << 26).start();

		/*
		 * try {
		 * InputReader(new
		 * FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in"));
		 * } catch (FileNotFoundException e) { // TODO Auto-generated catch
		 * block
		 * e.printStackTrace();
		 * }
		 */
		InputReader(System.in);
		pw = new PrintWriter(System.out);
		/*
		 * try {
		 * pw=new PrintWriter(new
		 * FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
		 * } catch (FileNotFoundException e) { // TODO Auto-generated catch
		 * block
		 * e.printStackTrace();
		 * }
		 */
		soln();
		pw.close();
	}

	public static void InputReader(InputStream stream1)
	{
		stream = stream1;
	}

	private static boolean isWhitespace(int c)
	{
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private static boolean isEndOfLine(int c)
	{
		return c == '\n' || c == '\r' || c == -1;
	}

	private static int read()
	{
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars)
		{
			curChar = 0;
			try
			{
				numChars = stream.read(buf);
			}
			catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private static int nextInt()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		while (!isSpaceChar(c));
		return res * sgn;
	}

	private static long nextLong()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		while (!isSpaceChar(c));
		return res * sgn;
	}

	private static String nextToken()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		}
		while (!isSpaceChar(c));
		return res.toString();
	}

	private static String nextLine()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		}
		while (!isEndOfLine(c));
		return res.toString();
	}

	private static int[] nextIntArray(int n)
	{
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}

	private static long[] nextLongArray(int n)
	{
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextLong();
		}
		return arr;
	}

	private static void pArray(int[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static void pArray(long[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static boolean isSpaceChar(int c)
	{
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private static char nextChar()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter
	{
		public boolean isSpaceChar(int ch);
	}
}

import java.util.Scanner;

/**
 *
 * @author moham
 */
public class NewMain25 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       Scanner input =new Scanner(System.in);
        int n = input.nextInt();
        String cha = input.next();
        if(n>2){
        char odd = cha.charAt(0);
        char even = cha.charAt(1);
        boolean ans = true;
        if(odd == even){
            ans = false;
        }else{
            for(int i=2;i<n;i++){
            if(i%2==0){
                if(cha.charAt(i)!=odd){
                    ans = false;
                    break;
                }
            }else{
                if(cha.charAt(i)!=even){
                    ans = false;
                    break;
                }
            }
            }
        }
        System.out.println((ans)?"Yes":"No");
        }else if(n==1){
            if(cha.charAt(0)=='1'){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }else if(n==2){
            if(cha.charAt(0)=='1'&&cha.charAt(1)=='1'){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }
    }
}

import java.util.Scanner;

public class Problem982A {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int m[] = new int[n];
		sc.nextLine();
		String[] row = sc.nextLine().split("(?!^)");
		for (int i = 0; i < n; i++) {
			m[i] = Integer.parseInt(row[i]);
		}

		if (n % 2 != 0) {
			boolean odd = true;
			for (int i = 0; i < n; i++) {
				if (odd) {
					if (m[i] != 1) {
						System.out.println("NO");
						sc.close();
						return;
					}
					odd = false;
				} else {
					if (m[i] != 0) {
						System.out.println("NO");
						sc.close();
						return;
					}
					odd = true;
				}
			}
		} else {
			for (int i = 0; i < n - 2; i++) {
				if (m[i] == 1) {
					if (m[i + 1] != 0) {
						System.out.println("NO");
						sc.close();
						return;
					}
					i++;
				} else {
					if (m[i + 1] == 0 && m[i + 2] == 0) {
						System.out.println("NO");
						sc.close();
						return;
					}
				}
			}
			if (m[n - 2] == 0) {
				if (m[n - 1] == 0) {
					System.out.println("NO");
					sc.close();
					return;
				}
			}
			else {
				if (m[n - 1] == 1) {
					System.out.println("NO");
					sc.close();
					return;
				}
			}
			if(m[0] == 0 && m[1] == 0) {
				System.out.println("NO");
				sc.close();
				return;
			}
		}

		System.out.println("YES");
		sc.close();
	}

}

import java.util.*;
public class HelloWorld{

      static void fun(String str,int n)
      {
          if(str.equals("1") || str.equals("0") )
          {
            System.out.print("Yes");
                return ;
          }
          String st="";
          for(int i=0;i<n-1;i++)
          {
              st=str.substring(i,i+2);
              if(st.equals("11"))
              {
              System.out.print("No");
                return ;
              }
          }
           st=str.substring(0,2);
          if(str.equals("00"))
          {
              System.out.print("No");
                 return ;
          }
          st=str.substring(n-2,n);
          if(st.equals("00"))
          {
              System.out.print("No");
                 return;
          }
         for(int i=0;i<n-2;i++)
         {
             st=str.substring(i,i+3);
             if(st.equals("000"))
             {
                 System.out.print("No");
                     return ;
             }
         }
         System.out.print("Yes");

      }
     public static void main(String []args)
     {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        String str=s.next();
        fun(str,n);
     }
}

import java.util.Scanner;

/**
 *
 * @author paras
 */
public class round484 {
    public static void main(String[] args) {
        Scanner ob=new Scanner(System.in);
int n=ob.nextInt();
String s=ob.next();
boolean b=true;
int count=0;
int re=n/2;
if(n%2!=0)
{
    re++;
}
char a[]=s.toCharArray();
if(n<=2)
{if(n==1 && s.equals("1"))
    {
        System.out.println("YES");
    }else if(n==2 && s.equals("01") || s.equals("10"))
    {
        System.out.println("YES");

    }
else
    {
        System.out.println("NO");
    }
}
else
{
    for(int i=0;i<n-1;i++)
    {
        if(a[i]==a[i+1] && a[i]=='1')
        {
            b=false;
            break;
        }
        if(a[i]=='1')
        {
            count++;
        }
    }
    if(a[n-1]=='1')
    {
        count++;
    }
    if(b && count==re)
    {
        System.out.println("Yes");
    }else
    {
        System.out.println("No");
    }

   }
}
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
	Scanner s = new Scanner(System.in);
        int n=s.nextInt();
        String str=s.next();
        if(n==1){
            if(str.charAt(0)=='0')
            System.out.println("No");
            if(str.charAt(0)=='1')
            System.out.println("Yes");

            return;
        }

        for(int i=0;i<n-2;i++){
        	if(str.charAt(i)=='0'&&str.charAt(i+1)=='0')
                    if(str.charAt(i+2)=='0'){
                        System.out.println("No");
                        return;
                    }
            if(str.charAt(i)=='0'&&str.charAt(i+1)=='1')
                    if(str.charAt(i+2)=='1'){
                        System.out.println("No");
                        return;
                    }
            if(str.charAt(i)=='1'&&str.charAt(i+1)=='1') {

                        System.out.println("No");
                        return;
                    }
        	}
        if(str.charAt(n-1)=='0'&&str.charAt(n-2)=='0')
        {
            System.out.println("No");
                        return;
        }
        System.out.println("yes");

	}
}

import java.io.*;
import java.util.*;

public class Main {

    class Answer {
        int N;
        String str;

        public String solve() {
            int max = (int) Math.floor(N / 2.0);
            int count1 = 0;
            for (int i = 0; i < N; i += 2) {
                if (str.charAt(i) == '1') {
                    if ((i < N-1) && str.charAt(i+1) == '1') return "No";
                    count1++;
                }
            }
            int count2 = 0;
            for (int i = 1; i < N; i += 2) {
                if (str.charAt(i) == '1') {
                    if ((i < N-1) && str.charAt(i+1) == '1') return "No";
                    count2++;
                }
            }
            return (count1 + count2 >= max ? "Yes" : "No");
        }

        public void main(FastScanner in, PrintWriter out) {
            N = in.nextInt();
            str = in.next();
            out.println( solve() );
        }

        public void p(Object o) { System.out.print(o); }
        public void pl(Object o) { System.out.println(o); }
        public void arp(int[] o) { pl( Arrays.toString(o) ); }
        public void arp(boolean[] o) { pl( Arrays.toString(o) ); }
        public void arpp(int[][] o) {
            for (int i = 0; i < o.length; i++) {
                for (int j = 0; j < o[0].length; j++) { p(o[i][j] + " "); }
                pl("");
            }
        }
        public void ck(Object o1, Object o2) { pl(o1 + " " + o2); }
        public void ckk(Object o1, Object o2, Object o3) { pl(o1 + " " + o2 + " " + o3); }
        public void ckkk(Object o1, Object o2, Object o3, Object o4) {
            pl(o1 + " " + o2 + " " + o3 + " " + o4);
        }

    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Main main = new Main();
        Answer ans = main.new Answer();
        ans.main(in, out);

        out.close();
        in.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try { st = new StringTokenizer(br.readLine()); }
                catch (IOException e) { e.printStackTrace(); }
            }
            return st.nextToken();
        }
        public String nextLine() {
            String str = "";
            try { str = br.readLine();
            } catch (IOException e) { e.printStackTrace(); }
            return str;
        }
        public void close() throws IOException { br.close(); }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ARow solver = new ARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARow {
        public void solve(int testNumber, InputReader reader, OutputWriter writer) {
            int n = reader.readInteger();
            String chairs = reader.readLine();

            if (n == 1 && chairs.charAt(0) == '1') {
                writer.print("Yes");
                return;
            } else if (n == 1) {
                writer.print("No");
                return;
            }

            boolean adjCond = true;

            for (int i = 1; i < n && adjCond; i++) {
                if (chairs.charAt(i) == '1' && chairs.charAt(i) == chairs.charAt(i - 1)) {
                    adjCond = false;
                }
                if (i > 0 && i < n - 1) {
                    if (chairs.charAt(i) == '0' && chairs.charAt(i - 1) == '0' && chairs.charAt(i + 1) == '0') {
                        adjCond = false;
                    }
                }
            }

            if (adjCond) {
                writer.print("Yes");
            } else {
                writer.print("No");
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInteger() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isNewlineChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public boolean isNewlineChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == '\n' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }
}

import java.util.Scanner;
public class Row{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        //sc.next();
        String s = sc.next();
        int tag = 0;
        for(int i = 0; i < s.length()-1; i++){
            char c = s.charAt(i);
            char d = s.charAt(i+1);
            if(c=='0' && d=='0' || c=='1' && d=='1'){
                tag++;
                break;
            }
        }
        //System.out.println(s);
        if(tag == 0)
        System.out.println("Yes");
        else
        System.out.println("No");
    }
}

import java.util.Scanner;

public class cf
{

	public static void main(String[] args)
	{

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		in.nextLine();
		String s = in.nextLine();

		int count = 0;
		int ans = 0;

		if (s.charAt(0) == '1')
		{
			count = 1;
		}

		for (int i = 1; i < n; i++)
		{
			if (s.charAt(i) == '1' && s.charAt(i - 1) == '1')
			{
				ans = 1;
				break;
			} else if (s.charAt(i) == '1')
			{
				count++;
			}
		}

		if (count == Math.ceil(n / 2.0))
		{
			ans = 0;
		} else
		{
			ans = 1;
		}

		if (ans == 1)
		{
			System.out.println("No");
		} else
		{
			System.out.println("Yes");
		}
	}

}

import java.util.Scanner;
public class Codeforces {
 public static void main(String args[]) {
	 Scanner sc = new Scanner(System.in);
	 int n = sc.nextInt();
	 int ctr=0;
	 int flag=0;
	 int max=(int)Math.ceil((double)n/(double)2);
	 String s = sc.next();
	 for(int i=0;i<s.length();i++)
	 {
		 if(i!=0&&s.charAt(i)=='1'&&s.charAt(i-1)=='1')flag=1;
		 if(s.charAt(i)=='1')ctr++;
	 }
	 if(flag==1)
	 System.out.println("No");
	 else if(flag==0&&ctr<max)
	 System.out.println("No");
	 else System.out.println("Yes");

 }
}

import java.util.Scanner;

public class con5 {

    static Scanner in;

    public static void main(String[] args) {
        in=new Scanner(System.in);
        int n=in.nextInt(),t=0;

        String s=in.next();

        if(n%2==0){

            for(int i=0;i<s.length()-1;i++){
                if(s.charAt(i)=='1'&&s.charAt(i+1)=='0'){

                }else if(s.charAt(i)=='0'&&s.charAt(i+1)=='1'){

                }else {
                    System.out.println("No");
                    return;
                }
            }
        }else {

            for(int i=0;i<n;i++){
                if(s.charAt(i)=='1'&&i%2==0){

                }else if(s.charAt(i)=='0'&&(i%2==1)) {

                }else{
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}

	import java.util.*;
	import javax.swing.plaf.synth.SynthSpinnerUI;
	import javax.swing.plaf.synth.SynthStyle;
	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.StringTokenizer;
	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.StringTokenizer;
	public class java4 {
	     public static void main(String[]arg) throws NumberFormatException, IOException  {
	         Scanner sc=new Scanner(System.in);
	         int n=sc.nextInt();String s=sc.next();boolean f1=true;boolean f2=true;int d=1;
	         if(n==1) {
	        	 if(s.charAt(0)=='1')System.out.print("YES");
	        	 else if(s.charAt(0)=='0')System.out.print("NO");
	         }
	         else {
	         for(int i=0;i<s.length()-1;i++) {
	        	if(s.charAt(i)=='1') {
	        		if(s.charAt(i+1)=='0')f1=true;
	        		else {
	        			f1=false;break;
	        		}
	        	}else {
	        		if(s.charAt(i)=='1')f2=true;
	        		else {
	        			if(d<=2) {
	        				f2=true;d++;
	        			}else {
	        				f2=false;break;
	        			}
	        		}
	        	}
	         }
	         if(f1&&f2)System.out.print("YES");
	         else System.out.print("NO");
	         }
	}}

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;

public class Watermelon {
    public static void main(String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out=new PrintWriter(System.out);
        StringTokenizer st=new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken());int[] arr=new int[n];
        String s=(br.readLine());
        for(int i=0;i<n;i++){
            arr[i]=Integer.parseInt(s.charAt(i)+"");
        }
        if(n==1){
            if(arr[0]!=1)
                System.out.println("no");
            else System.out.println("yes");
            System.exit(0);
        }
        int count=0;
        for(int i=0;i<n;i++){
            int flag=0,flag1=0;
            if(arr[i]==1) {
                count+=1;
                if (i == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey1");
                    flag=1;
                }
                if (i>0 && i<n-1 && arr[i - 1] == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey2");
                    flag=1;
                }
                if (i == n - 1 && arr[i - 1] == 0){
//                    System.out.println("Hey3");
                    flag=1;
                }
            }
            else{
                if (i == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey1");
                    flag1=1;
                }
                if (i>0 && i<n-1 && arr[i - 1] == 0 && arr[i + 1] == 0){
//                    System.out.println("Hey2");
                    flag1=1;
                }
                if (i == n - 1 && arr[i - 1] == 0){
//                    System.out.println("Hey3");
                    flag1=1;
                }
            }
            if(flag==0 || flag1==1){
                System.out.println("No");
                System.exit(0);
            }
        }

    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }
}

	import java.util.*;
	import javax.swing.plaf.synth.SynthSpinnerUI;
	import javax.swing.plaf.synth.SynthStyle;
	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.StringTokenizer;
	import java.io.BufferedReader;
	import java.io.IOException;
	import java.io.InputStreamReader;
	import java.util.StringTokenizer;
	public class java4 {
	     public static void main(String[]arg) throws NumberFormatException, IOException  {
	         Scanner sc=new Scanner(System.in);
	         int n=sc.nextInt();String s=sc.next();boolean f=true;
	         if(n==1) {
	        	 if(s.charAt(0)=='1')System.out.print("YES");
	        	 else if(s.charAt(0)=='0')System.out.print("NO");
	         }
	         else {
	         for(int i=0;i<s.length()-1;i++) {
	        	 if(s.charAt(i)!=s.charAt(i+1))f=true;
	        	 else {
	        		 f=false;break;
	        	 }
	         }
	         if(f)System.out.print("YES");
	         else System.out.print("NO");
	         }
	}}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A {

	static int n ;

	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();

		char [] s  = sc.next().toCharArray();
		if(n<2) {
			System.out.println("No");
			return;
		}
		boolean f4 = true;
		for(int i = 0 ; i<n-1 ; i++)
			f4 &= !(s[i] == '1'&&s[i+1]=='1');

		boolean f = true;
		for(int i = 0 ; i<n ; i++) {
			char [] b = s.clone();
			if(b[i] == '1') continue;
			b[i] = '1';

			boolean f3 = true;

			for(int  j= 0 ; j<n-1 ; j++) {
				f3 &= !(b[j] == '1'  && b[j+1]=='1');
			}

			f&=!f3;
		}

		System.out.println(f&& f4 ? "YES":"NO");

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream fileReader) {
			br = new BufferedReader(new InputStreamReader(fileReader));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.io.*;
import java.util.*;

public class Row {
	public static void print(String line) {
		System.out.println(line);
	}
	public static void print(int line) {
		System.out.println(line + "");
	}

	public static void main(String[] args) {
		// num_chair: number of chairs
		// seating: number used to represent how the seats are allocated
		int num_chair = 0, seating = 0;
		Scanner in = new Scanner(System.in);
		num_chair = in.nextInt();
		seating = in.nextInt();
		in.close();
		int[] list = new int[num_chair];
		for (int i = 0; i < num_chair; i++) {
			list[num_chair - i - 1] = seating % 10;
			seating /= 10;
		}
		if (num_chair == 1) {
			print("No");
			return;
		}
		if (num_chair == 2) {
			if ((list[0] + list[1]) % 2 == 0) {
				print("No");
			}
			else {
				print("Yes");
			}
			return;
		}
		if ((list[0] == 0 && list[1] == 0) || (list[num_chair-1] == 0 && list[num_chair-2] == 0)) {
			print("No");
			return;
		}

		int count = 0;

		for (int i = 1; i < num_chair; i++) {
			if (list[i] == 1 && list[i-1] == 1) {
				print("No");
				return;
			}
			if (list[i] == 0) {
				count++;
				if (count >= 3) {
					print("No");
					return;
				}
			}
			else {
				count = 0;
			}
		}
		print("Yes");
	}
}

import java.io.*;
import java.util.*;
public class Main
{
	public static void main(String[] args)throws IOException {
		InputStreamReader read=new InputStreamReader(System.in);
		BufferedReader in=new BufferedReader(read);
		int n=Integer.parseInt(in.readLine());
		String str=in.readLine();
		if(str.contains("11"))
		System.out.println("No");
		else
		System.out.println("Yes");
	}
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.TreeMap;

public class Maze {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s=new Scanner(System.in);
		int nn=s.nextInt();
		String str=s.next();
		//String str=Integer.toString(n);
		boolean flag=false;
		int count=0;
		boolean flaga=false;
		for(int i=0;i<nn;i++){
			if(str.charAt(i)=='1'&&flag){
				flaga=true;
				break;
			}
			if(str.charAt(i)=='1'){
				flag=true;
				count=0;
			}
			else{
				count++;
				flag=false;
			}
			if(count>1&&(i==1||i==nn-2)){
				flaga=true;
				break;
			}
			if(count>2){
				flaga=true;
				break;
			}

		}
	//	System.out.println(num1+" "+num2);
		if(flaga){
			System.out.println("No");
		}
		else{
			System.out.println("Yes");
		}
	}
}

import java.util.Scanner;

/**
 *
 * @author paras
 */
public class round484 {
    public static void main(String[] args) {
        Scanner ob=new Scanner(System.in);
int n=ob.nextInt();
String s=ob.next();
boolean b=true;
int count=0;
char a[]=s.toCharArray();
for(int i=0;i<n-1;i++)
{
    if(a[i]=='1')
    {
     count++;
    }
    if(a[i]==a[i+1])
    {
        b=false;
        break;
    }
}if(a[n-1]=='1')
{
    count++;
}
int se=n/2;
if(n%2!=0)
{
    se++;
}
if(b && se==count)
{
    System.out.println("YES");
}else
{
    System.out.println("NO");
}
    }
}

/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Code1
{

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int n = in.nextInt();
		char[] s = in.nextLine().toCharArray();

		if(n==1)
		{
			if(s[0]=='1')
				pw.println("Yes");
			else
				pw.print("No");
		}
		else
		{
		boolean flag = true;
		for(int i=0;i<n-1;i++)
		{
			if(s[i]=='1' && s[i+1]=='1')
				flag = false;
		}

		if(flag)
		{
			for(int i=0;i<n-2;i++)
			{
				if(s[i]=='0' && s[i+1]=='0' && s[i+2]=='0')
					flag = false;
			}
		}

		if(flag)
			pw.println("Yes");
		else
			pw.println("No");
		}
		pw.flush();
		pw.close();
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}

import java.util.Scanner;

public class Codeforces982ASecand {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        String word = input.next();
        boolean state = true;
        if (n == 1 && word.equals("0")){
            System.out.println("No");
            return;
        }
        for (int i = 1; i < n - 1; i++) {
            if (word.charAt(i) == '0' &&( word.charAt(i - 1) == '1' || word.charAt(i + 1) == '1')){

            }else if (word.charAt(i) == '1' &&( word.charAt(i - 1) == '0' && word.charAt(i + 1) == '0')){

            }else{
                state = false;
                break;
            }
        }

        System.out.println(state?"Yes":"No");
    }
}

import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		FastScanner input = new FastScanner(System.in);

		int N = input.nextInt();
		String s = input.next();

		if (s.charAt(0) == '0')
			s = new StringBuilder(s).reverse().toString();

		int expected = 1;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) - '0' != expected) {
				System.out.println("No");
				return;
			}
			expected ^= 1;
		}

		System.out.println("YES");
	}

	// Matt Fontaine's Fast IO
	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

import java.util.Scanner;

public class Sloution {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		if(n==1)
		{
			int p = sc.nextInt();
			System.out.println("YES");
		}
		else if(n==2)
		{
			String str = sc.next();
			int p = str.charAt(0);
			int q = str.charAt(1);

			if((p=='1' && q=='1') || (p=='0' && q=='0'))
					System.out.println("NO");
			else
					System.out.println("YES");
		}
		else if(n==3)
		{
			String str = sc.next();
			int p = str.charAt(0);
			int q = str.charAt(1);
			int r = str.charAt(2);

			if((p=='1' && q=='0' && r=='1') || (p=='0' && q=='1' && r=='0') || (p=='0' && q=='0' && r=='1'))
			{
				System.out.println("YES");
			}
			else
			{
				System.out.println("NO");
			}
		}
		else
		{
			int flag=0;
			String str = sc.next();
			int[] arr = new int[n];

		for(int i=0;i<n;i++)
		{
			arr[i] = Integer.parseInt(str.charAt(i)+"");
		}
		//System.out.println(Arrays.toString(arr));
		for(int i=0;i<n-1;i++)
		{
			if(arr[i]==arr[i+1])
			{
				if(arr[i]==1)
				{
					flag=1;
					break;
				}
				else if(arr[i]==0 && arr[i-1]==0) { flag=1; break; }

			}

		}
		//System.out.println(flag);
		System.out.println(flag==1 ? "NO" : "YES");

		}
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A982 {
   public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        String s = br.readLine();
        boolean set = true;

        int count = 0;
        for(int i = 0; i < t-1 && set; i++)
        {
            if(s.charAt(i) == 1 && s.charAt(i+1) == 1 || (i < t-2 && s.charAt(i) == 0 && s.charAt(i+1) == 0 && s.charAt(i+2) == 0) || (i == t-2 && s.charAt(i) == 0 && s.charAt(i+1) == 0) )
                set = false;
            if(s.charAt(i) == '1')
                count++;
        }
        if(s.charAt(t-1) == '1')
            count++;
        if(count != ((t+1)/2))
            set = false;

        System.out.println(set? "Yes" : "No");
    }

}

import java.util.Scanner;

public class ProblemA {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        String str = sc.next();
        boolean invalid = false;
        for (int i = 0 ; i < n ; i++){
            char current = str.charAt(i);
            if( current == '1' && (i < str.length() -2 && str.charAt(i+1) =='1')){
                invalid = true;
            }
            else if(current == '0'){
                invalid = (i-1 >= 0? (str.charAt(i-1) =='0') : true );
                invalid |= (i+1 <= str.length()-1? (str.charAt(i+1) =='0') : true );
                break;
            }
            if(invalid)
                break;

        }

        if(!invalid)
            System.out.println("Yes");
        else System.out.println("No");
    }
}

import java.util.Scanner;

public class cf
{

	public static void main(String[] args)
	{

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		in.nextLine();
		String s = in.nextLine();

		int f = 0;
		if (s.charAt(0) == '1')
		{
			f = 1;
		}
		int ans = 0;
		for (int i = 0; i < s.length(); i++)
		{
			if (f == 1)
			{
				if (i % 2 == 0 && s.charAt(i) != '1')
				{
					ans = 1;
					break;
				} else if (i % 2 != 0 && s.charAt(i) != '0')
				{
					ans = 1;
					break;
				}
			} else
			{
				ans = 1;
			}
		}

		if (ans == 0)
		{
			System.out.println("Yes");
		} else
		{
			System.out.println("No");
		}

	}

}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;
        Solver s = new Solver();
        for (int i = 1; i <= t; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {

    void solve(int test, InputReader in, PrintWriter out) {
        in.nextInt();
        String s = in.next();
        if (s.length() == 1) {
            out.println(s.charAt(0) == '1' ? "Yes" : "No");
            return;
        }
        if (s.contains("11")) {
            out.println("No");
            return;
        }
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '0') {
                if (i + 1 < s.length() && s.charAt(i + 1) == '0') {
                    out.println("No");
                    return;
                }
                if (i > 0 && s.charAt(i - 1) == '0') {
                    out.println("No");
                    return;
                }
            }
        }
        out.println("Yes");
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

import java.util.Scanner;

public class ca {
    public static void main(String[] args) {

        Scanner skan = new Scanner(System.in);

        int n  = skan.nextInt();

        String s = skan.next();

        if (s.length()==1 && s.equals("0")){
            System.out.println("NO");
            return;
        }

        else if (s.length()==1 && s.equals("1")){
            System.out.println("YES");
            return;
        }

        for (int i = 0; i <n-2; i++) {
            if (s.charAt(i)!=s.charAt(i+2) || s.charAt(i)==s.charAt(i+1)){
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
	Scanner s = new Scanner(System.in);
        int n=s.nextInt();
        String str=s.next();
        if(n==1){
            if(str.charAt(0)=='0')
            System.out.println("No");
            if(str.charAt(0)=='1')
            System.out.println("Yes");

            return;
        }

        for(int i=0;i<n-2;i++){
        	if(str.charAt(i)=='0'&&str.charAt(i+1)=='0')
                    if(str.charAt(i+2)=='0'){
                        System.out.println("No");
                        return;
                    }
            if(str.charAt(i)=='0'&&str.charAt(i+1)=='1')
                    if(str.charAt(i+2)=='1'){
                        System.out.println("No");
                        return;
                    }
            if(str.charAt(i)=='1'&&str.charAt(i+1)=='1') {

                        System.out.println("No");
                        return;
                    }
        	}
        if(str.charAt(n-1)=='0'&&str.charAt(n-2)=='0')
        {
            System.out.println("No");
                        return;
        }
        System.out.println("yes");

	}
}

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int a[] = new int[n];
	String text = sc.next();
	for(int i = 0; i < text.length(); i++){
	  a[i] = Character.getNumericValue(text.charAt(i));
	}

	if(n == 1){
		if(a[0] == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
	} else{

		boolean valid = false;
		int checkNum = 0;
		if(a[0] == 1)
		  checkNum = 1;
		else if(a[0] == 0)
		  checkNum = 0;

		for(int i = 0; i <= n-2; i+=2){
		  if(a[i] == checkNum && a[i+1] == (1 - checkNum)){
			valid = true;
		  } else {
			valid = false;
			break;
		  }
		}

		if(valid){
		  System.out.println("Yes");
		} else {
		  System.out.println("No");
		}
	}
  }
}

import java.io.*;
import java.util.*;

public class Row
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		boolean isMaximal = true;
		int chairs = sc.nextInt();
		//char[] charsArray = (sc.next()).toCharArray();
		String chairArrangement = sc.next();

		sc.close();

		if (chairs == 1)
		{
			if (chairArrangement == "1")
				isMaximal = true;
			else
				isMaximal = false;
		}
		else if (chairs == 2)
		{
			if (chairArrangement.charAt(0) == '0' && chairArrangement.charAt(1) == '0')
				isMaximal = true;
			else
				isMaximal = false;
		}
		else
		{
			isMaximal = splitString(chairArrangement, chairs);
		}

		if (isMaximal == true)
		{
			System.out.println("Yes");
		}
		else if (isMaximal == false)
		{
			System.out.println("No");
		}
	}

	public static boolean splitString(String inputString, int maxStrings)
	{
		boolean isMaximal = true;

		StringBuilder checkString = new StringBuilder();

		checkString.append(inputString.charAt(0) + "");

		for (int k = 1; k < inputString.length(); k++)
		{
			if ((inputString.charAt(k-1) - '0') != (inputString.charAt(k) - '0'))
			{
				checkString.setLength(0);
			}

			checkString.append(inputString.charAt(k) + "");
			String currentCheckString =checkString.toString();
			//System.out.println(currentCheckString);

			if (checkString.toString().equals("11"))
			{
				isMaximal = false;
				break;
			}
			if (checkString.toString().equals("000"))
			{
				isMaximal = false;
				break;
			}
		}

		return isMaximal;
	}

}

import java.io.*;
import java.util.*;

public class Main {

    class Answer {
        int N;
        String str;

        public String solve() {
            if (N == 1 && str.equals("0")) {
                return "No";
            }
            int s = -1;

            for (int i = 0; i < N; i++) {
                if (str.charAt(i) == '1') {
                    if (s != -1 && ((i-s) > 3  || (i-s) <= 1)) return "No";
                    s = i;
                }
            }
            return "Yes";
        }

        public void main(FastScanner in, PrintWriter out) {
            N = in.nextInt();
            str = in.next();
            out.println( solve() );
        }

        public void p(Object o) { System.out.print(o); }
        public void pl(Object o) { System.out.println(o); }
        public void arp(int[] o) { pl( Arrays.toString(o) ); }
        public void arp(boolean[] o) { pl( Arrays.toString(o) ); }
        public void arpp(int[][] o) {
            for (int i = 0; i < o.length; i++) {
                for (int j = 0; j < o[0].length; j++) { p(o[i][j] + " "); }
                pl("");
            }
        }
        public void ck(Object o1, Object o2) { pl(o1 + " " + o2); }
        public void ckk(Object o1, Object o2, Object o3) { pl(o1 + " " + o2 + " " + o3); }
        public void ckkk(Object o1, Object o2, Object o3, Object o4) {
            pl(o1 + " " + o2 + " " + o3 + " " + o4);
        }

    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Main main = new Main();
        Answer ans = main.new Answer();
        ans.main(in, out);

        out.close();
        in.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try { st = new StringTokenizer(br.readLine()); }
                catch (IOException e) { e.printStackTrace(); }
            }
            return st.nextToken();
        }
        public String nextLine() {
            String str = "";
            try { str = br.readLine();
            } catch (IOException e) { e.printStackTrace(); }
            return str;
        }
        public void close() throws IOException { br.close(); }
    }
}

import java.util.ArrayList;
import java.util.Scanner;

public class cf
{

	static ArrayList[] adj;
	static int[] visited;
	static int ans = 0;

	public static void main(String[] args)
	{

		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		in.nextLine();
		String s = in.nextLine();
		int ans = 0;

		for (int i = 1; i < n; i++)
		{
			if (s.charAt(i) == '1' && s.charAt(i - 1) == '1')
			{
				ans = 1;
				break;
			}
		}

		for (int i = 0; i < n; i++)
		{
			if (s.charAt(i) == '0')
			{
				if (i == 0 && i + 1 < n && s.charAt(i + 1) == '0')
				{
					ans = 1;
					break;
				}
				if (i == n - 1 && i-1>=0 && s.charAt(i - 1) == '0')
				{
					ans = 1;
					break;
				}

				if (i != 0 && i != n - 1)
				{
					if (s.charAt(i - 1) == '0' && s.charAt(i + 1) == '0')
					{
						ans = 1;
						break;
					}
				}
			}
		}

		if (ans == 1)
		{
			System.out.println("No");
		} else
		{
			System.out.println("Yes");
		}

	}

	public static int dfs(int i)
	{
		if (visited[i] == 1)
		{
			return 0;
		}

		visited[i] = 1;

		int sum = 1;

		for (int j = 0; j < adj[i].size(); j++)
		{
			sum += (int) dfs((int) adj[i].get(j));
		}

		if (sum % 2 == 0)
		{
			ans++;
			return 0;
		}

		return sum;
	}

}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		if(n==1){
		    if(s.equals("1")){System.out.println("Yes");}
		    else{System.out.println("No");}
		}
		else if(n==2){
		    if(s.equals("10") || s.equals("01")){
		        System.out.println("Yes");
		    }else{
		        System.out.println("No");
		    }
		}

		else{
		    int r=0;
		    int count0=0,count1=0;
		    for(int i=0;i<s.length()-1;i++){
		        if(s.charAt(i)==s.charAt(i+1) && s.charAt(i)=='0'){
		            count0=count0+2;
		        }
		        else if(s.charAt(i)== s.charAt(i+1) && s.charAt(i)=='1'){count1=count1+2;}

		        else{count1=0;count0=0;}
		        System.out.println(count0+"  "+count1);
		        if(count0>=2 && i==0){r=1;break;}
		        else if(count1==2){r=1;break;}
		        else if(count0>=3){r=1;break;}
		        else if(count0>=2 && i==(n-2)){r=1;break;}
		    }
		    if(r==1){System.out.println("No");}
		    else{System.out.println("Yes");}

		}

	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nirav
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scan in = new Scan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARow solver = new ARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARow {
        public void solve(int testNumber, Scan in, PrintWriter out) {
            int n = in.scanInt();
            String str = in.scanString();
            boolean check = true;

            for (int i = 1; i < str.length() - 1; i++) {
                char g = (char) (str.charAt(i - 1) + str.charAt(i + 1));
                if ((str.charAt(i - 1) == '0' && str.charAt(i + 1) == '0') && str.charAt(i) == '0') {
                    check = false;
                } else if (g > '0' && str.charAt(i) == '1') {
                    check = false;
                }

            }

            if (n > 2) {
                if (str.charAt(1) == '0' && str.charAt(0) == '0') {
                    check = false;
                }
//
                if (str.charAt(n - 2) == '0' && str.charAt(n - 1) == '0') {
                    check = false;
                }

//            if( str.charAt(n-2)=='1' && str.charAt(n-1)=='1'){
//                check=false;
//            }
//            if( (str.charAt(1)=='1' && str.charAt(0)=='1')){
//                check=false;
//            }

            } else if (n == 2) {
                return;
            }
            if (n == 1) {
                if (str.charAt(0) == '0') {
                    check = false;
                } else {
                    check = true;
                }
            }

            if (check) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class Scan {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan() {
            in = System.in;
        }

        public Scan(InputStream inputStream) {
            in = inputStream;
        }

        public int scan() {
            if (total < 0) {
                return 0;
            }
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    System.out.println(e);
                }
                if (total <= 0)
                    return -1;

            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else throw new InputMismatchException();
            }
            return neg * integer;
        }

        public String scanString() {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }

    }
}

import java.util.*;
import java.io.*;

public class Solution1 {

    private void solve() throws IOException {
        int n = in.nextInt();

        String pas = in.next();
        if (n == 1) {
            System.out.println("No");
            return;
        }
        int x = Integer.parseInt(pas.substring(0, 1));
        for (int i = 1; i < n; i++) {
            if (pas.charAt(i) == '1') {
                if (x == 1) {
                    System.out.println("No");
                    return;
                }
            }
            if (pas.charAt(i) == '0') {
                if (x == 0) {
                    System.out.println("No");
                    return;
                }
            }
            x = Integer.parseInt(pas.substring(i, i + 1));
        }

        System.out.println("Yes");
    }

    private PrintWriter out;
    private MyScanner in;

    private void run() throws IOException {
        in = new MyScanner();
        out = new PrintWriter(System.out);
        solve();
        in.close();
        out.close();
    }

    private class MyScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public MyScanner() throws IOException {
            this.br = new BufferedReader(new InputStreamReader(System.in));
        }

        public MyScanner(String fileTitle) throws IOException {
            this.br = new BufferedReader(new FileReader(fileTitle));
        }

        public String nextLine() throws IOException {
            String s = br.readLine();
            return s == null ? "-1" : s;
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                String s = br.readLine();
                if (s == null) {
                    return "-1";
                }
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        public Integer nextInt() throws IOException {
            return Integer.parseInt(this.next());
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(this.next());
        }

        public Double nextDouble() throws IOException {
            return Double.parseDouble(this.next());
        }

        public void close() throws IOException {
            this.br.close();
        }
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Solution1().run();
    }
}

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        String b =sc.next();
        char[] s=b.toCharArray();
        int a[] = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i]=s[i]-48;
        }
        int d = 0;
        int sum=0;
        if (a[0] == 1) {
            d = 0;
        } else {
            d = 1;
            sum++;
        }
        if(n==1 && a[0]==0){
            System.out.println("No");
            return;
        }
        for (int i = 1; i < a.length; i++) {
            if(a[i]==0){
                sum++;
                d=0;
            }
            if(sum>=3){
                System.out.println("No");
                return;
            }
            if(a[i]==1){
                if(d==1){
                    System.out.println("No");
                    return;
                }
                sum=0;
            }
        }
        System.out.println("Yes");

    }

}

import java.util.Scanner;
        import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s =sc.next();
        char[]a=s.toCharArray();
        if(n==1){
            if(a[0]=='0'){
                System.out.println("NO");
            }
            else {
                System.out.println("Yes");
            }
            return;
        }
        if(n==2) {
            if (a[0] == a[1]) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
            }
            return;
        }
       else if(a[0]=='1' && a[1]=='1'){
            System.out.println("NO");
            return;
        }
        else if(a[n-1]=='1' && a[n-2]=='1'){
            System.out.println("NO");
            return;
        }
        for (int i = 1; i <n-1 ; i++) {
            if(a[i]=='1' && a[i-1]=='1' || a[i]==1 &&a[i+1]=='1'){
                System.out.println("NO");
                return;
            }
            if(a[i]=='0' && i!=n-1){
                int col=1;
                while(a[i]==a[i+1]){
                    col++;
                    if(i+1==n-1){
                        if(col>=3) {
                            System.out.println("NO");
                            return;
                        }
                        else{
                            System.out.println("YES");
                        }
                        break;
                    }
                    if(col>=3){
                        System.out.println("NO");
                        return;
                    }
                    i++;
                }
            }

        }
        System.out.println("YES");
    }
}

import java.io.*;
import java.util.*;

public class Row
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);

		boolean isMaximal = true;
		int chairs = sc.nextInt();
		//char[] charsArray = (sc.next()).toCharArray();
		String chairArrangement = sc.next();

		sc.close();

		if (chairs == 1)
		{
			if (chairArrangement.equals("1"))
				isMaximal = true;
			else
				isMaximal = false;
		}
		else if (chairs == 2)
		{
			if (chairArrangement.equals("00"))
				isMaximal = true;
			else
				isMaximal = false;
		}
		else
		{
			isMaximal = splitString(chairArrangement, chairs);
		}

		if (isMaximal == true)
		{
			System.out.println("Yes");
		}
		else if (isMaximal == false)
		{
			System.out.println("No");
		}
	}

	public static boolean splitString(String inputString, int maxStrings)
	{
		boolean isMaximal = true;

		StringBuilder checkString = new StringBuilder();

		checkString.append(inputString.charAt(0) + "");

		for (int k = 1; k < inputString.length(); k++)
		{
			if ((inputString.charAt(k-1) - '0') != (inputString.charAt(k) - '0'))
			{
				checkString.setLength(0);
			}

			checkString.append(inputString.charAt(k) + "");
			String currentCheckString =checkString.toString();
			//System.out.println(currentCheckString);

			if (checkString.toString().equals("11"))
			{
				isMaximal = false;
				break;
			}
			if (checkString.toString().equals("000"))
			{
				isMaximal = false;
				break;
			}
			if (checkString.toString().equals("00") && (k == inputString.length() -1))
			{
				isMaximal = false;
				break;
			}
			if (checkString.toString().equals("00") && (k == 1))
			{
				isMaximal = false;
				break;
			}
		}

		return isMaximal;
	}

}

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        String b =sc.next();
        char[] s=b.toCharArray();
        int a[] = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i]=s[i]-48;
        }
        int d = 0;
        int sum=0;
        if (a[0] == 1) {
            d = 0;
        } else {
            d = 1;
            sum++;
        }
        if(n==1 && a[0]==0){
            System.out.println("No");
            return;
        }
        for (int i = 1; i < a.length; i++) {
            if(a[i]==0){
                sum++;
                d=0;
            }
            if(a[i]==1){
                if(d==1){
                    System.out.println("No");
                    return;
                }
                sum=0;
                d=1;
            }
            if(sum>=3){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");

    }

}

import java.util.Scanner;

public class Row {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int i,sum,j,n;
        boolean is;
        String s,s1;
        while (input.hasNext()){
            n = input.nextInt(); s1 = input.nextLine(); is = false; sum = 0;

            s = input.nextLine();
            if (n == 1 && (s.charAt(0) == '1')){
                is = false;
            }
            else if (n == 1 && (s.charAt(0) == '0')) is = true;

            if (n == 2 && (s.charAt(0) == '1' || s.charAt(1) == '0') && (s.charAt(0) == '0' || s.charAt(1) == '1')) is = false;

            if (n == 2 && s.charAt(0) == '0' && s.charAt(1) == '0') is = true;

            if (n ==2 && s.charAt(0) == '0' && s.charAt(1) == '0') is = true;

            for (i=0; i<n-1; i++){
                if (s.charAt(i) == '1' && s.charAt(i+1) == '1') is = true;
            }
            if (!is){
                for (i=0; i<n; i++){
                    sum = 0;
                    if (s.charAt(i) == '0'){
                        while (i<n && s.charAt(i) != '1'){
                            sum++;
                            i++;
                        }
                        i--;
                        if (n == i+1 && sum == 2){
                            is = true;
                            break;
                        }
                    }
                    if (sum >= 3) {
                        is = true;
                        break;
                    }

                }
            }

            if (!is) System.out.println("YES");
            else System.out.println("NO");

        }
    }
}

import java.util.*;
public class Contest {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
        Scanner obj = new Scanner(System.in) ;
        int n = obj.nextInt() ;
        String g = obj.next() ;
        int compt=0 ;
        boolean vis = false ;
        for(int i=0 ; i<n-1;i++){

        	if(g.charAt(i)=='1' & g.charAt(i)==g.charAt(i+1))   {
        		System.out.println("No");vis=true ;
        		break ;
        	}
        	if(g.charAt(i)=='0'){
        		compt+=1 ;
        	}
        	if(compt==3) {
        		System.out.println("No");vis=true ;  break ;
        	}
        	if(g.charAt(i)=='1')  compt =0 ;

        }

        if(g.charAt(n-1)=='0' & compt==1 & (!vis)) System.out.println("No");
        else if(!vis) System.out.println("Yes");

	}

}

import java.io.*;
import java.util.*;
public class row
{
    public static void main (String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String st = br.readLine();
        char[] chairs = st.toCharArray();
        int counter = 0;
        boolean check;
        if (n == 1 && chairs[0] == '1')
        {
            System.out.println("Yes");
            System.exit(0);
        }
        else if (n == 1 && chairs[0] == '0')
        {
            System.out.println("No");
            System.exit(0);
        }
        if (n == 2 && chairs[0] == '0' && chairs[1] == '0')
        {
            System.out.println("No");
            System.exit(0);
        }
        if (chairs[0] == '1')
        {
            check = true;
        }
        else
        {
            check = false;
        }
        for (int i = 1 ; i < n ; i++)
        {
            if (counter == 2 && i == 3)
            {
                System.out.println("No");
                System.exit(0);
            }
            if (counter == 2 && i == n)
            {
                System.out.println("No");
                System.exit(0);
            }
            if (chairs[i] == '1' && check == false && counter <= 2)
            {
                check = true;
                counter = 0;
            }
            else if (chairs[i] == '0' && check == true)
            {
                check = false;
                counter++;
            }
            else
            {
                System.out.println("No");
                System.exit(0);
            }
        }
        System.out.println("Yes");
        System.exit(0);
    }
}

import java.util.Scanner;

public class Row{
	public static void main(String args[]){
		int m,i,j;
		Scanner sc = new Scanner (System.in);
		m = sc.nextInt();
		String s;
		s = sc.next();
		for(i=0;i<m-1;i++){
			if(s.charAt(i)!=s.charAt(i+1)){
					continue;
			}
			else break;
			}
		if(i==m-1){System.out.print("YES");}
		else{System.out.print("NO");}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nirav
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scan in = new Scan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARow solver = new ARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARow {
        public void solve(int testNumber, Scan in, PrintWriter out) {
            int n = in.scanInt();
            String str = in.scanString();
            boolean check = false;

            for (int i = 1; i < str.length() - 1; i++) {
                if (str.charAt(i - 1) == '0' && str.charAt(i + 1) == '0' && str.charAt(i) == '0') {
                    check = true;
                } else if ((str.charAt(i - 1) + str.charAt(i + 1)) > '0' && str.charAt(i) == '1') {
                    check = true;
                }

            }

            if (n > 1) {
//            if(str.charAt(1)=='0' && str.charAt(0)=='0'){
//                check=true;
//            }
//
//            if (str.charAt(n - 2) == '0' && str.charAt(n - 1) == '0') {
//                check = true;
//            }
            }
            if (n == 1) {
                if (str.charAt(0) == '0') {
                    check = true;
                } else {
                    check = false;
                }
            }

            if (check) {
                out.println("No");
            } else {
                out.println("Yes");
            }
        }

    }

    static class Scan {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan() {
            in = System.in;
        }

        public Scan(InputStream inputStream) {
            in = inputStream;
        }

        public int scan() {
            if (total < 0) {
                return 0;
            }
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    System.out.println(e);
                }
                if (total <= 0)
                    return -1;

            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else throw new InputMismatchException();
            }
            return neg * integer;
        }

        public String scanString() {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }

    }
}

import java.util.*;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		sc.nextLine();
		String s = sc.nextLine();

		boolean flag = true;
		int index =0;
		while(index<n && s.charAt(index)=='0'){
		    index++;
		}

		if (index>=1){
		    //System.out.println("Here");
		    flag=false;
		}else{
		    index = n-1;
		    //System.out.println(index);
		    while(index>=0 && s.charAt(index)=='0'){
		        index--;
		    }
		   // System.out.println(index);
		    if (n-1-index>1){
		        //System.out.println(n-index);
		        flag=false;
		    }
		    else{
		        for (int i =0;i<n-1;i++) {
			    if (s.charAt(i)=='1'){
			    int count =0;
			    for (int j=i+1;j<n;j++){
			        if (s.charAt(j)=='0')
			        count++;
			        else
			        break;
			    }
			    //System.out.println(count);
			    if (count>2 || count==0){
			        flag=false;
			        break;
			    }
			    }
		        }
		    }
		}

		if (n==1){
		    if (s.charAt(0)=='0')
		    flag=false;
		    else
		    flag=true;
		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();

	}

}

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        while(cin.hasNext()){
            int n = cin.nextInt();
            String s = cin.next();
            int cnt =s.charAt(0)=='0'?1:0;
            int fg = 0;
            for(int i = 1;i < s.length();i++){
                if(s.charAt(i)=='1'&&s.charAt(i)==s.charAt(i-1)||cnt>=3){
                    fg = 1;
                    break;
                }
                if(s.charAt(i)=='0'){
                    cnt++;
                }
            }
            if(n==1){
                if(s.charAt(0)=='1'){
                    System.out.println("Yes");
                }
                else{

                    System.out.println("No");
                }
                continue;
            }
            if(fg == 1){
                System.out.println("No");
            }
            else{
                System.out.println("Yes");
            }
        }
    }
}

import java.util.Scanner;

public class test{
    public static  void main(String arg[]){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        String  i= s.next();
        int l = i.length();
        int c=1;
        String a="Yes";
        for(int p=1; p<l; p++){
        if(i.charAt(p)==i.charAt(p-1)){
            c++;
            int t = 0+i.charAt(p);
            if(t==48 && c<3)
            a="Yes";
            else{
                a="No"; break;
            }
        }
        else c=1;
    }
    System.out.print(a);

}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.InputMismatchException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Nirav
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scan in = new Scan(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARow solver = new ARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARow {
        public void solve(int testNumber, Scan in, PrintWriter out) {
            int n = in.scanInt();
            String str = in.scanString();
            boolean check = true;

            for (int i = 1; i < str.length() - 1; i++) {
                char g = (char) (str.charAt(i - 1) + str.charAt(i + 1));
                if ((str.charAt(i - 1) == '0' && str.charAt(i + 1) == '0') && str.charAt(i) == '0') {
                    check = false;
                } else if (g > '0' && str.charAt(i) == '1') {
                    check = false;
                }

            }

            if (n == 2) {
                if (str.charAt(1) == '0' && str.charAt(0) == '0') {
                    check = false;
                }
//
                if (str.charAt(n - 2) == '0' && str.charAt(n - 1) == '0') {
                    check = false;
                }
            }
            if (n == 1) {
                if (str.charAt(0) == '0') {
                    check = false;
                } else {
                    check = true;
                }
            }

            if (check) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }

    static class Scan {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan() {
            in = System.in;
        }

        public Scan(InputStream inputStream) {
            in = inputStream;
        }

        public int scan() {
            if (total < 0) {
                return 0;
            }
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    System.out.println(e);
                }
                if (total <= 0)
                    return -1;

            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else throw new InputMismatchException();
            }
            return neg * integer;
        }

        public String scanString() {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }

    }
}

import java.io.*;
import java.util.*;
public class SOL
{
	//public static long mod = 1000000007;
	public static void main(String[] ar)throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String s = br.readLine();
		int len = s.length(),f=0;
		//System.out.println(len);
		if(n<=2)
			System.out.println("Yes");
		else{
		if(s.charAt(0)=='1')
		{
			for(int i=0;i<len;i++)
			{
				if(i%2==0)
				{
					if(s.charAt(i)!='1')
					{
						f=1;
						break;
					}
				}
				else
				{
					if(s.charAt(i)!='0')
					{
						f=1;
						break;
					}
				}
			}
			if(f==1)
				System.out.println("No");
			else
				System.out.println("Yes");
		}
		else
		{
			for(int i=0;i<len;i++)
			{
				if(i%2==0)
				{
					if(s.charAt(i)!='0')
					{
						f=1;
						break;
					}
				}
				else
				{
					if(s.charAt(i)!='1')
					{
						f=1;
						break;
					}
				}
			}
			if(f==1)
				System.out.println("No");
			else
				System.out.println("Yes");
		}
		}
	}
}

import java.io.*;
import java.util.*;

public class Row {

	public static void main(String[] args) {
        FastScanner in = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        char ch[] = in.next().toCharArray();
        int max = 0;
        for(int i=0;i<n;i++){
            if(ch[i]=='0'){
                int cnt = 0;
                while(i<n&&ch[i]=='0'){
                    cnt++;i++;
                }
                if(i<n) i--;
                max = Math.max(max, cnt);
            }
        }
        out.println((max<=2)?"Yes":"No");
        out.flush();
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while(!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				}catch(IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		int[] readArray(int n) {
			int a[] = new int[n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}

		Integer[] readArray(long n) {
		    Integer a[] = new Integer[(int)n];
			for(int i=0;i<n;i++) a[i] = nextInt();
			return a;
		}

		long[] readArray(int n,long x) {
			long a[] = new long[n];
			for(int i=0;i<n;i++) a[i] = nextLong();
			return a;
		}

	}

	static class Pair implements Comparable<Pair> {
		int x, y;
		Pair(int a, int b){ x = a; y = b; }
		int getKey() { return x; }
		int getVal() { return y; }
		@Override
		public int compareTo(Pair o) {
			if(o.getVal() - this.getVal()>0)
				return -1;
			else if(o.getVal() - this.getVal()<0)
				return 1;
			else
				return 0;
		}

	}

	static boolean arrayEquals(char a[], char b[]) {
		int n = a.length;
		boolean verdict = true;
		for(int i=0;i<n;i++) {
			if(a[i]!=b[i]) {
				verdict = false;break;
			}
		}
		return verdict;
	}

	static long lcm(long a, long b) {
		return (a*b)/gcd(a,b);
	}

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

	static long hashInt(int x,int y) {
		return x*(1_000_000_000L)+y;
	}
}

import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class row {

	public static void main(String[] args) throws Exception {
		new row().run();
	}

	public void run() throws Exception {
		FastIO file = new FastIO();
		int n = file.nextInt();
		char[] c = file.next().toCharArray();
		boolean works = true;
		for (int i = 1; i < n; i++) {
			works &= c[i] != c[i-1];
		}
		if (n == 1) works &= c[0] == '1';
		System.out.println(works ? "Yes" : "No");
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, (p - 1) / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, (p - 1) / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ankur
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String str = in.readString();
            if (str.charAt(0) == '1') {
                int ct = 0;
                for (int i = 0; i < n; i++) {
                    if (i % 2 == 0) {
                        if (str.charAt(i) != 1) {
                            out.print("NO");
                            return;
                        }

                    } else {
                        if (str.charAt(i) != '0') {
                            out.print("NO");
                            return;
                        }
                    }
                }
                out.print("YES");

            } else {
                for (int i = 0; i < n; i++) {
                    if (i % 2 != 0) {
                        if (str.charAt(i) != 1) {
                            out.print("NO");
                            return;
                        }

                    } else {
                        if (str.charAt(i) != '0') {
                            out.print("NO");
                            return;
                        }
                    }
                }
                out.print("YES");
            }
        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            //*-*------clare------
//remeber while comparing 2 non primitive data type not to use ==
//remember Arrays.sort for primitive data has worst time case complexity of 0(n^2) bcoz it uses quick sort
//again silly mistakes ,yr kb tk krta rhega ye mistakes
//try to write simple codes ,break it into simple things
//knowledge>rating
        /*
        public class Main
        implements Runnable{
    public static void main(String[] args) {
        new Thread(null,new Main(),"Main",1<<26).start();

    }
    public void run() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();//chenge the name of task
        solver.solve(1, in, out);
        out.close();
    }
         */

            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

  import java.io.*;
    import java.util.*;

        public class Codeforces {

    		   public static long log2(long x)
    			{
    				long p=1;
    				long ans=0;
    				while(x>=p)
    				{
    					p*=2;
    					ans++;
    				}
    				return ans-1;
    			}

    		   public static void extendedgcd(int a, int b)
    		   {
    			   x=0;
    			   y=0;
    			   gc=0;
    			   xgcd(a,b);
    			   pw.println(a+"*"+x+" + "+b+"*"+y+" = "+gc);

    		   }

    		   public static long modex(long a, long b, long c)
    		   {
    			   if(b==0)
    				   return 1;
    			   else if(b==1)
    				   return a%c;
    			   else if(b%2==0)
    			   {
    				   	return modex((a*a)%c,b/2,c);
    			   }
    			   else
    			   {
    				   return (a*modex((a*a)%c,b/2,c))%c;

    			   }

    		   }

    		   public static void xgcd(int a, int b)
    		   {

    			   if(b==0)
    			   {
    				   x=1;
    				   y=0;
    				   gc=a;

    			   }
    			   else
    			   {
    				   xgcd(b,a%b);
    				   int temp = x;
    				   x=y;
    				   y = temp - ((a/b)*y);

    			   }
    		   }

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

    		   }

    		   static int x,y,gc;

    		   static HashSet<Character> set;

    		   public static int expmod(int a, int b, int mod)
    		   {
    			   if(b==0)return 1;
    			   if(b==1)return a;

    			   if(b%2==0)
    			   {
    				   return ((expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    			   else
    			   {
    				   return ((a%mod)*(expmod(a,b/2,mod)%mod)*(expmod(a,b/2,mod)%mod))%mod;
    			   }
    		   }

    		   static class Comp implements Comparator<Point>
    		   {

				@Override
				public int compare(Point arg0, Point arg1) {

					if(arg0.x>arg1.x)return 1;
					if(arg0.x<arg1.x)return -1;
					return 0;
				}

    		   }
    		   static class Point
    		   {
    			   int x,y,ind;

    			    public Point(int a, int b, int i)
    			    {
    			    	x=a;
    			    	y=b;
    			    	ind=i;
    			    }

    		   }

    		   public static void main(String[] args)
    	   {
    			//a=97

    			int n = sc.nextInt();

    			String st = sc.nextLine();

    			int flg=1;

    			char arr[] = st.toCharArray();
    			for(int i=0;i<n-1;i++)
    			{
    				if(arr[i]=='1'&&arr[i+1]=='1')
    				{
    					flg=0; break;
    				}

    			}

    			for(int i=0;i<n;i++)
    			{
    				if(arr[i]=='0')
    				{
    					int n1=0,n2=0;
    					if(i-1>=0&&arr[i-1]=='0')n1=1;
    					if(i+1<n&&arr[i+1]=='0')n2=1;

    					if(n1==0&&n2==0)
    					{
    						flg=0; break;
    					}

    				}

    			}

    			String an = (flg==1)?"Yes":"No";

    			pw.close();

    	   }

    		   static  class MyScanner
    			{

    			BufferedReader br;
    			StringTokenizer st;

    			public MyScanner()
    			{
    				br = new BufferedReader(new InputStreamReader(System.in));
    			}

    			String next()
    			{

    				while (st == null || !st.hasMoreElements())
    				{
    					try
    					{
    						st = new StringTokenizer(br.readLine());
    					} catch (IOException e)
    					{
    						e.printStackTrace();
    					}
    				}
    				return st.nextToken();
    			}

    			int nextInt()
    			{
    				return Integer.parseInt(next());
    			}

    			long nextLong()
    			{
    				return Long.parseLong(next());
    			}

    			double nextDouble()
    			{
    				return Double.parseDouble(next());
    			}

    			String nextLine()
    			{
    				String str = "";
    				try
    				{
    					str = br.readLine();
    				} catch (IOException e)
    				{
    					e.printStackTrace();
    				}
    				return str;
    			}

    		}

    		static MyScanner sc = new  MyScanner();
    		static PrintWriter pw = new PrintWriter(System.out, true);

    	}

import java.io.*;
import java.util.*;

public class Main {

    class Answer {
        int N;
        String str;

        public String solve() {
            int max = (int) Math.ceil(N / 2.0);
            int count1 = 0;
            for (int i = 0; i < N; i += 2) {
                if (str.charAt(i) == '1') {
                    if ((i < N-1) && str.charAt(i+1) == '1') return "No";
                    count1++;
                }
            }
            int count2 = 0;
            for (int i = 1; i < N; i += 2) {
                if (str.charAt(i) == '1') {
                    if ((i < N-1) && str.charAt(i+1) == '1') return "No";
                    count2++;
                }
            }
            return (count1 + count2 == max ? "Yes" : "No");
        }

        public void main(FastScanner in, PrintWriter out) {
            N = in.nextInt();
            str = in.next();
            out.println( solve() );
        }
    }

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Main main = new Main();
        Answer ans = main.new Answer();
        ans.main(in, out);

        out.close();
        in.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try { st = new StringTokenizer(br.readLine()); }
                catch (IOException e) { e.printStackTrace(); }
            }
            return st.nextToken();
        }
        public String nextLine() {
            String str = "";
            try { str = br.readLine();
            } catch (IOException e) { e.printStackTrace(); }
            return str;
        }
        public void close() throws IOException { br.close(); }
    }
}

import java.util.Scanner;
public class Row{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        String s = sc.next();
        if(a==1){
            if(s.charAt(0)=='0')
            System.out.println("No");
            else
            System.out.println("Yes");
        }
        else if(a==2){
            System.out.println("No");
        }
        else{
        int tag = 0;
        for(int i = 0; i < s.length()-1; i++){
            char c = s.charAt(i);
            char d = s.charAt(i+1);
            char e = i==0?s.charAt(i+2):s.charAt(i-1);
            if(c=='0' && d=='0' && e =='0'|| c=='1' && d=='1'){
                tag++;
                break;
            }
        }
        if(s.charAt(s.length()-1) == '0' && s.charAt(s.length()-2)=='0' || s.charAt(0)=='0'&&s.charAt(1)=='0')
        tag++;
        //System.out.println(s);
        if(tag == 0)
        System.out.println("Yes");
        else
        System.out.println("No");
    }}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A982 {
   public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        String s = br.readLine();
        boolean set = true;
        if(t%2 == 1 && s.charAt(0) == '0')
            set = false;

        for(int i = 0; i < t-1 && set; i++)
            if(s.charAt(i)==s.charAt(i+1))
                set = false;

        System.out.println(set? "Yes" : "No");
    }

}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputReader in = new InputReader();
        PrintWriter out = new PrintWriter(System.out);
        int t = 1;
        Solver s = new Solver();
        for (int i = 1; i <= t; i++) {
            s.solve(i, in, out);
        }
        out.close();
    }
}

class Solver {

    void solve(int test, InputReader in, PrintWriter out) {
        in.nextInt();
        String s = in.next();
        if (s.length() == 1) {
            out.println("YES");
            return;
        }
        StringBuilder s1 = new StringBuilder();
        StringBuilder s2 = new StringBuilder();
        for (int i = 0; i < s.length(); i++) if (i % 2 == 0) {
            s1.append("1");
            s2.append("0");
        } else {
            s1.append("0");
            s2.append("1");
        }
        if (s.equals(s1.toString()) || s.equals(s2.toString())) {
            out.println("YES");
        } else out.println("NO");
    }
}

class InputReader {
    BufferedReader br;
    StringTokenizer st;

    public InputReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

import java.io.*;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        String b =sc.next();
        char[] s=b.toCharArray();
        int a[] = new int[n];
        for (int i = 0; i < a.length; i++) {
            a[i]=s[i]-48;
        }
        int l=0;
        int d = 0;
        int sum=0;
        if (a[0] == 1) {
            d = 0;
            l=1;
        } else {
            d = 1;
            l=0;
        }
        if(n==1 && a[0]==0){
            System.out.println("No");
            return;
        }
        for (int i=l; i < a.length; i++) {
            if(a[i]==0){
                sum++;
                d=0;
            }
            if(a[i]==1){
                if(d==1){
                    System.out.println("No");
                    return;
                }
                sum=0;
                d=1;
            }
            if(sum>=3){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");

    }

}

import java.util.Scanner;

public class test{
    public static  void main(String arg[]){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        String  i= s.next();
        int l = i.length();
        int c=1;
        String a="Yes";
        if(l==1 && i.charAt(0)=='0')
        a="No";
        else{
        for(int p=1; p<l; p++){
        if(i.charAt(p)==i.charAt(p-1)){
            c++;
            int t = 0+i.charAt(p);
            if(t==48 && c<3)
            a="Yes";
            else{
                a="No"; break;
            }
        }
        else c=1;
    }}

}
}

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

public class code {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner read=new Scanner(System.in);

		int w=read.nextInt();

		String s=read.next();
		int k=-1;
		int l=-1;
		boolean swp=false;
		for(int i=0;i<s.length();i++) {
			if(swp==false && s.charAt(i)=='1') {
				k=i;
				swp=true;
				continue;
			}
			if(swp==true && s.charAt(i)=='1') {
				l=i;
				int n=l-k-1;
				if(n>2) {
					System.out.println("No");
					return ;
				}
				else if(n==0) {
					System.out.println("No");
					return ;
				}
				else {
					swp=false;
					i=i-1;
					continue;
				}

			}

		}
		System.out.println("Yes");return ;
}
}

import java.util.Scanner;

public class Raf {
     static Scanner sc=new Scanner(System.in);
	public static void main(String[] args) {

	   int nint=sc.nextInt();
	   sc.nextLine();
	   String n=sc.nextLine();
	   String dOne="11";
	   String sl="00";
	   String check="000";
	   if(n.indexOf(check)!=(-1) || n.indexOf(dOne) !=(-1) || n.indexOf(sl)==0 || n.indexOf(sl)==n.length()-2)  {
		  System.out.println("No");
	  }else {
	   System.out.println("Yes");
	   }

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A982 {
   public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        String s = br.readLine();
        boolean set = true;

        int count = 0;
        for(int i = 0; i < t-1 && set; i++)
        {
            if(s.charAt(i) == 1 && s.charAt(i+1) == 1 || (i < t-2 && s.charAt(i) == 0 && s.charAt(i+1) == 0 && s.charAt(i+2) == 0) )
                set = false;
            if(s.charAt(i) == '1')
                count++;
        }
        if(s.charAt(t-1) == '1')
            count++;
        if(count != ((t+1)/2))
            set = false;

        System.out.println(set? "Yes" : "No");
    }

}

//cf484v3
import java.util.Scanner;
public class cf484v3 {

   public static boolean maximal(int numChairs, String seating) {
      if(seating.length() == 1 && seating.equals("1")) {
         return true;
      }else if(seating.length() == 1) {
         return false;
      }

      int fullCount = 0; //counter variable for occupied seats
      System.out.println(seating);
      for(int i = 0; i < seating.length(); i++) {
         if(seating.charAt(i) == '1') {
            fullCount++;
         }
      }
      /*System.out.println("fullCount =" + fullCount);
      //check if any two adjacent seats are full
      for(int i = 0; i < seating.length() - 1; i++) {
         if(seating.charAt(i) == '1' && seating.charAt(i + 1) == '1') {
            return false;
         }

      }*/

      //check if there are ever 2 0s in row
      for(int i = 0; i < seating.length() - 2; i++) {
         if(seating.charAt(i) == '0' && seating.charAt(i + 1) == '0'
            && seating.charAt(i + 2) == '0') {
               return false;
         }
      }
      return true;

   } //end of helper method

   public static void main(String[] args) {
      Scanner kb = new Scanner(System.in);
      int numChairs = kb.nextInt();
      //int seating = kb.nextInt();
      String seatings = kb.next();
      if(maximal(numChairs, seatings)) {
         System.out.print("Yes");
      }else{
         System.out.print("No");
      }
   } //end of main
}

//package R481Div3;

import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;

public class RA {

	public static void main(String[] args) {

		FastScanner s = new FastScanner();
		int n = s.nextInt();
		String S = s.nextString();
		char[] c = S.toCharArray();

		char[] p = new char[n];

		if(n==1)
		{
			if(c[0]=='0')
			{
				System.out.println("No");return;
			}
		}
		if(n==2)
		{
			if(S.equals("01")||S.equals("10"))
			{
				System.out.println("Yes");return;
			}
			else
			{
				System.out.println("No");return;
			}
		}
		if(c[0]=='0'||c[n-1]=='0')
		{
			System.out.println("No");return;
		}

		for(int i=0;i<n;i++)
		{
			if(i-1>=0&&i+1<n)
			{
				if(c[i]=='1')
				{
					if(c[i-1]=='0'&&c[i+1]=='0'&&i+1!=n-1&&i-1!=0)
						continue;
					else
					{
						System.out.println("No");return;
					}
				}
			}
			if(i>1)
			{
				if(c[i]=='1')
				{
					if(c[i-2]=='0')
					{
						System.out.println("No");return;
					}
				}
			}
		}

		System.out.println("Yes");

	}
static class FastScanner {

	    private InputStream mIs;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner() {
			this(System.in);
		}

		public FastScanner(InputStream is) {
			mIs = is;
		}

		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = mIs.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;

		}

	}

}

import java.util.Scanner;
        import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n==1){
            System.out.println("Yes");
            return;
        }
        String s =sc.next();
        char[]a=s.toCharArray();
        if(n==2) {
            if (a[0] == a[1]) {
                System.out.println("NO");
            } else {
                System.out.println("YES");
            }
            return;
        }
       else if(a[0]=='1' && a[1]=='1'){
            System.out.println("NO");
            return;
        }
        else if(a[n-1]=='1' && a[n-2]=='1'){
            System.out.println("NO");
            return;
        }
        for (int i = 1; i <n-1 ; i++) {
            if(a[i]=='1' && a[i-1]=='1' || a[i]==1 &&a[i+1]=='1'){
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}

import java.util.Scanner;

public class Test {
	static int[] x;
	static int[] y;
	static int n1;
	static int[] masterp;
	static long[][] ss;

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		String string = s.next();
		char last = 'a';
		boolean chered = true;
		boolean is1 = false;
			if(!string.contains("1")){
				System.out.println("No");
			}
			else if(string.contains(repeat(3, "0"))){
				System.out.println("No");
			}
			else if(string.contains("11")){
				System.out.println("No");
			}
			else if(string.contains("001")){
				string = string.replaceFirst("001", "x");
				if(string.charAt(0)=='x'){
					System.out.println("No");
				}
			}
			else if(string.contains("100")){
				string = string.replace("100", "x");
				if(string.charAt(string.length()-1)=='x'){
					System.out.println("No");
				}
			}
			else{
				System.out.println("Yes");
			}
	}

	public static void fill(int a, int b, int w) {
		ss[a][b] = w;
	}

	public static String repeat(int count, String with) {
		return new String(new char[count]).replace("\0", with);
	}
}

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner keyboard = new Scanner(System.in);
		int numChairs = keyboard.nextInt(); keyboard.nextLine();
		if(numChairs == 1) {
			System.out.println("Yes");
			return;
		}
		String occupation = keyboard.nextLine();

		char[] chairs = occupation.toCharArray();

		char previousChair = chairs[0];

		for(int i = 1; i < numChairs; i++) {
			if(previousChair == chairs[i]) {
				System.out.println("No");
				return;
			}
			previousChair = chairs[i];
		}

		System.out.println("Yes");
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Roy
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ARow solver = new ARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARow {
        public void solve(int testNumber, InputReader reader, OutputWriter writer) {
            int n = reader.readInteger();
            String chairs = reader.readLine();

            if (n == 1 && chairs.equals("0")) {
                writer.print("No");
                return;
            }

            boolean adjCond = true;

            for (int i = 1; i < n && adjCond; i++) {
                if (chairs.charAt(i) == '1' && chairs.charAt(i - 1) == '1') { //-> 00011 adj one check...
                    adjCond = false;
                }
                //-> 010001 adj triple zeros check...
                if (i > 0 && i < n - 1 && chairs.charAt(i) == '0' && chairs.charAt(i - 1) == '0' && chairs.charAt(i + 1) == '0') {
                    adjCond = false;
                }
                //-> 010100 last two zeros check...
                if (i == n - 1 && chairs.charAt(i) == '0' && chairs.charAt(i - 1) == '0') {
                    adjCond = false;
                }
            }

            if (adjCond) {
                writer.print("Yes");
            } else {
                writer.print("No");
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);

                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInteger() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isNewlineChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public boolean isNewlineChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == '\n' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.flush();
            writer.close();
        }

    }
}

import java.util.Scanner;

public class ca {
    public static void main(String[] args) {

        Scanner skan = new Scanner(System.in);

        int n  = skan.nextInt();

        String s = skan.next();
        String s2 = "";

        for (int i = 0; i <n; i++) {
            if (i%2==0){
                s2+="1";
            }
            else{
                s2+="0";
            }
        }
        System.out.println(s.equals(s2)?"YES":"NO");
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A {

	static int n ;

	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();

		char [] s  = sc.next().toCharArray();
		if(n<2) {
			System.out.println("No");
			return;
		}
		boolean f4 = true;
		for(int i = 0 ; i<n-1 ; i++)
			f4&=!(s[i] == '1'&&s[i+1]=='1');

		boolean f = true;
		for(int i = 0 ; i<n ; i++) {
			char [] b = s.clone();
			if(b[i] == '1') continue;
			b[i] = '1' ;

			boolean f3 = false;
			for(int  j= 0 ; j<n-1 ; j++) {
				f3 |= (b[j] == '1'  && b[j+1]=='1');
			}

			f&=f3;
		}

		System.out.println(f&& f4 ? "YES":"NO");

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream fileReader) {
			br = new BufferedReader(new InputStreamReader(fileReader));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputReader reader = new InputReader(System.in);
		int n = reader.nextInt();
		String myString = reader.next();
		if (n == 1) {
			System.out.println("Yes");
		}

		if(n==2&&myString.charAt(0)==myString.charAt(1)&&myString.charAt(0)=='0') {
			System.out.println("Yes");
		}

		else {
			boolean check = true;
			for (int i = 0; i < n - 1; i++) {
				if (myString.charAt(i) == myString.charAt(i + 1)) {
					if(myString.charAt(i)=='0'&&myString.charAt(i)!=myString.charAt(i+2)) {
						continue;
					}else {
					check = false;
					break;
					}
				}

			}
			if (check == true) {
				System.out.println("Yes");
				}
			else {
				System.out.println("No");

			}

		}
	}

	static class InputReader {
		StringTokenizer tokenizer;
		BufferedReader reader;
		String token;
		String temp;

		public InputReader(InputStream stream) {
			tokenizer = null;
			reader = new BufferedReader(new InputStreamReader(stream));
		}

		public InputReader(FileInputStream stream) {
			tokenizer = null;
			reader = new BufferedReader(new InputStreamReader(stream));
		}

		public String nextLine() throws IOException {
			return reader.readLine();
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					if (temp != null) {
						tokenizer = new StringTokenizer(temp);
						temp = null;
					} else {
						tokenizer = new StringTokenizer(reader.readLine());
					}

				} catch (IOException e) {
				}
			}
			return tokenizer.nextToken();
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Created by prituladima on 5/17/18.
 */
public class C_982_A {

    private void solve() throws IOException {

        int n = nextInt();

        char[] chars = nextToken().replaceAll("000", "*").replaceAll("11", "*").toCharArray();

        if (n == 1) {
            if (chars[0] == '1') {
                System.out.println("YES");
                return;
            } else {
                System.out.println("NO");
                return;
            }
        }

        if (n == 2){
            if(chars[0] == '0' && chars[1] == '0'){
                System.out.println("NO");
                return;
            }
        }

        for (int i = 0; i < chars.length; i++) {
            if ('*' == chars[i]) {
                System.out.println("NO");
                return;
            }
        }

        System.out.println("YES");

    }

    public static void main(String[] args) {
        new C_982_A().run();
    }

    StringTokenizer tokenizer;
    BufferedReader reader;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    int[] nextArr(int size) throws NumberFormatException, IOException {
        int[] arr = new int[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextInt();
        return arr;
    }

    long[] nextArrL(int size) throws NumberFormatException, IOException {
        long[] arr = new long[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextLong();
        return arr;
    }

    double[] nextArrD(int size) throws NumberFormatException, IOException {
        double[] arr = new double[size];
        for (int i = 0; i < size; i++)
            arr[i] = nextDouble();
        return arr;
    }

}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	void solve()
	{
		int n = ni();
		char[] s = ns(n);
		if(n == 1) {
			out.println(s[0]=='0'?"No":"Yes");
			return;
		}
		for(int i = 1;i < n-1;i++) {
			if(s[i] == '1' && (s[i-1] == '1' || s[i+1] == '1')) {
				out.println("No");
				return;
			}
		}

		for(int i = 1;i < n-1;i++) {
			if(s[i] == '0' && s[i-1] != '1' && s[i+1] != '1') {
				out.println("No");
				return;
			}
		}
		if(s[n-1] == '0' && s[n-2] == '0') {
			out.print("No");
			return;
		}
		out.println("Yes");

	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{ new Main().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try
			{ lenbuf = is.read(inbuf); }
			catch (IOException e)
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip()
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd()
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}

		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o)
	{ System.out.println(Arrays.deepToString(o)); }
}

import java.util.Scanner;

public class con5 {

    static Scanner in;

    public static void main(String[] args) {
        in=new Scanner(System.in);
        int n=in.nextInt(),t=0;
        if(n%2==0){
            t=n/2;
        }else {
            t=(n/2)+1;
        }
        String s=in.next();

        int k=0;
        boolean dec=true;
        for(int i=0;i<s.length();i++){
            if(dec&&s.charAt(i)=='1'){
                ++k;
                dec=false;
            }else if((!dec)&&s.charAt(i)=='0'){
                dec=true;
            }else {
                System.out.println("No");
                return;
            }
        }
        if(k==t){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}

import java.io.*;
import java.util.*;

public class Row {
	public static void print(String line) {
		System.out.println(line);
	}
	public static void print(int line) {
		System.out.println(line + "");
	}

	public static void main(String[] args) {
		// num_chair: number of chairs
		// seating: number used to represent how the seats are allocated
		int num_chair = 0, seating = 0;
		Scanner in = new Scanner(System.in);
		num_chair = in.nextInt();
		seating = in.nextInt();
		in.close();
		int[] list = new int[num_chair];
		for (int i = 0; i < num_chair; i++) {
			list[num_chair - i - 1] = seating % 10;
			seating /= 10;
		}
		boolean empty = false;
		int count = 0;
		for (int i = 1; i < num_chair; i++) {
			if (list[i] == 1 && list[i-1] == 1) {
				print("No");
				return;
			}
			if (list[i] == 0) {
				count++;
				if (count >= 3) {
					empty = true;
				}
			}
			else {
				count = 0;
			}
		}
		if (empty) {
			print("No");
		}
		else {
			print("Yes");
		}
	}
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here

		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		if(n==1){
		    if(s=="1"){System.out.println("Yes");}
		    else{System.out.println("No");}
		}
		else if(n==2){
		    if(s=="10" || s=="01"){
		        System.out.println("Yes");
		    }else{
		        System.out.println("No");
		    }
		}

		else{
		    int r=0;
		    int count0=0,count1=0;
		    for(int i=0;i<s.length()-1;i++){
		        if(s.charAt(i)==s.charAt(i+1) && s.charAt(i)=='0'){
		            count0=count0+2;
		        }
		        else if(s.charAt(i)== s.charAt(i+1) && s.charAt(i)=='1'){count1=count1+2;}

		        else{count1=0;count0=0;}

		        if(count0>=2 && i==0){r=1;break;}
		        else if(count1==2){r=1;break;}
		        else if(count0>=3){r=1;break;}
		    }
		    if(r==1){System.out.println("No");}
		    else{System.out.println("Yes");}

		}

	}
}

import java.util.Scanner;

/**
 *
 * @author paras
 */
public class round484 {
    public static void main(String[] args) {
        Scanner ob=new Scanner(System.in);
int n=ob.nextInt();
String s=ob.next();
boolean b=true;
int count=0;
StringBuilder ab=new StringBuilder();
StringBuilder ab1=new StringBuilder();
for(int i=0;i<n;i++)
{if(i%2==0){
ab1.append("0");
ab.append("1");}
else
{
    ab.append("0");
    ab1.append("1");
}

}

   if(ab.toString().equals(s) || ab1.toString().equals(s))
{
    System.out.println("YES");
}else
{
    System.out.println("NO");
}
   }
}

import java.util.Scanner;

public class con5 {

    static Scanner in;

    public static void main(String[] args) {
        in=new Scanner(System.in);
        int n=in.nextInt(),t=0;

        String s=in.next();
        int zero=1;
        if(s.charAt(0)=='1'){
            zero=0;
        }
        for(int i=1;i<s.length();i++){

            if(s.charAt(i)=='1'){
                if(zero==1||zero==2){

                }else {
                    System.out.println("No");
                    return;
                }
                zero=0;
            }else{
                ++zero;
            }

        }
        if((zero==1&&n==1)||zero>1){
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}

/*
 *
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology
 *
 */

import java.util.*;
import java.io.*;
import java.lang.*;

public class Code1
{

	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);

		int n = in.nextInt();
		String s = in.nextLine();

		if(n%2==0)
		{
			String s1 = "";
			String s2 = "";

			for(int i=0;i<n;i++)
			{
				if(i%2==0)
				{
					s1+='0';
					s2+='1';
				}
				else
				{
					s1+='1';
					s2+='0';
				}
			}

			if(s1.equals(s) || s2.equals(s))
				pw.println("Yes");
			else
				pw.println("No");
		}
		else
		{
			String s1 = "";
			for(int i=0;i<n;i++)
			{
				if(i%2==0)
				{
					s1+='1';
				}
				else
				{
					s1+='0';
				}
			}
			if(s1.equals(s))
				pw.println("Yes");
			else
				pw.println("No");
		}
		pw.flush();
		pw.close();
	}

	static class InputReader
	{

		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int snext()
		{
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars)
			{
				curChar = 0;
				try
				{
					snumChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
		    {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n)
		{
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
			{
				a[i] = nextInt();
			}
			return a;
		}

		public String readString()
	    {
			int c = snext();
			while (isSpaceChar(c))
			{
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine()
		{
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c)
		{
			return c == '\n' || c == '\r' || c == -1;
		}

		public interface SpaceCharFilter
	    {
			public boolean isSpaceChar(int ch);
		}
	}

	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;

	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}

	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}

	public static HashSet<Integer> primeFactorization(int n)
	{
		HashSet<Integer> a =new HashSet<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}

	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;

		isPrime[0] = false;
		isPrime[1] = false;

		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}

	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}

	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}

	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}

	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}

	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static long modularExponentiation(long x,long n,long M)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}

	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}

	public static boolean isPrime(int n)
	{

	    if (n <= 1)  return false;
	    if (n <= 3)  return true;

	    if (n%2 == 0 || n%3 == 0)
	    	return false;

	    for (int i=5; i*i<=n; i=i+6)
	    {
	        if (n%i == 0 || n%(i+2) == 0)
	           return false;
	    }

	    return true;
	}

	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}

		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);

			return result;
		}

		public String toString()
		{
			return x+" "+y;
		}

		public boolean equals(Object o)
		{
			if (o instanceof pair)
		    {
				pair p = (pair)o;
				return p.x == x && p.y == y ;
			}
			return false;
		}

		public int hashCode()
		{
			return new Long(x).hashCode()*31 + new Long(y).hashCode();
		}
	}
}

import java.util.Scanner;

/**
 *
 * @author moham
 */
public class NewMain25 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       Scanner input =new Scanner(System.in);
        int n = input.nextInt();
        String cha = input.next();
        boolean ans = true;
        if(n>1){
        for(int i=1;i<n;i++){
            if(cha.charAt(i)=='1'){
                if(i+1<n){
                    if(cha.charAt(i+1)!='0'||cha.charAt(i-1)!='0'){
                        ans=false;
                        break;
                    }
                }else{
                    if(cha.charAt(i-1)!='0'){
                        ans=false;
                        break;
                    }
                }
            }else{
                if(i+1<n){
                    if(cha.charAt(i+1)=='0'&&cha.charAt(i-1)=='0'){
                        ans=false;
                        break;
                    }
                }else{
                    if(cha.charAt(i-1)=='0'){
                        ans=false;
                        break;
                    }
                }
            }
        }
        System.out.println((ans)?"Yes":"No");
        }else{
            System.out.println((cha.charAt(0)=='1')?"Yes":"No");
        }
    }
}

import java.io.*;
import java.util.*;
public class Solution
{
    public static void main(String args[])throws IOException
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[]=new int[n];
        int flag=0,count=0;
        char temp[] =sc.next().toCharArray();
        for(int i=0;i<n;i++)
        {
            //a[i]=Integer.parseInt(String.valueOf(temp[i]));
            //or
            a[i]=Character.getNumericValue(temp[i]);
            //System.out.println(a[i]);
        }
        //System.out.println(Math.ceil((float)n/2));

        if(a[0]==1)
         count++;

        for(int i=1;i<n;i++)
        {
            if(a[i]==1)
            {
                if(a[i-1]==1)
                {
                    flag=1;
                    break;
                }
                else
                {
                    count++;
                }
            }
        }
        //System.out.println(count);
        if(count!=(int)Math.ceil((float)n/2))
            flag=1;
            if(flag==0)
            System.out.println("Yes");
            else
            System.out.println("No");

    }
}

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		InputReader reader = new InputReader(System.in);
		int n = reader.nextInt();
		String myString = reader.next();
		if (n == 1) {
			System.out.println("Yes");
		}

		if(n==2&&myString.charAt(0)==myString.charAt(1)&&myString.charAt(0)=='0') {
			System.out.println("No");
		}

		else {
			boolean check = true;
			for (int i = 0; i < n - 1; i++) {
				if (myString.charAt(i) == myString.charAt(i + 1)) {
					if(myString.charAt(i)=='0'&&myString.charAt(i)!=myString.charAt(i+2)) {
						continue;
					}else {
					check = false;
					break;
					}
				}

			}
			if (check == true) {
				System.out.println("Yes");
				}
			else {
				System.out.println("No");

			}

		}
	}

	static class InputReader {
		StringTokenizer tokenizer;
		BufferedReader reader;
		String token;
		String temp;

		public InputReader(InputStream stream) {
			tokenizer = null;
			reader = new BufferedReader(new InputStreamReader(stream));
		}

		public InputReader(FileInputStream stream) {
			tokenizer = null;
			reader = new BufferedReader(new InputStreamReader(stream));
		}

		public String nextLine() throws IOException {
			return reader.readLine();
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					if (temp != null) {
						tokenizer = new StringTokenizer(temp);
						temp = null;
					} else {
						tokenizer = new StringTokenizer(reader.readLine());
					}

				} catch (IOException e) {
				}
			}
			return tokenizer.nextToken();
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anshh31
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        ProblemARow solver = new ProblemARow();
        solver.solve(1, in, out);
        out.close();
    }

    static class ProblemARow {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            String seats = in.next();
            boolean neighbour = false;
            int count0 = 0, count1 = 0;
            for (int i = 0; i < n - 1; i++) {
                if (seats.charAt(i) == '0')
                    count0++;
                else count1++;
                if (seats.charAt(i) == seats.charAt(i + 1)) neighbour = true;
            }
            if (seats.charAt(n - 1) == '0')
                count0++;
            else count1++;
            if (neighbour || count0 > count1)
                out.println("No");
            else out.println("Yes");
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

    }
}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main
{
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	void solve()
	{
		int n = ni();
		char[] s = ns(n);
		for(int i = 1;i < n-1;i++) {
			if(s[i] == '1' && (s[i-1] == '1' || s[i+1] == '1')) {
				out.println("No");
				return;
			}
		}

		for(int i = 1;i < n-1;i++) {
			if(s[i] == '0' && s[i-1] != '1' && s[i+1] != '1') {
				out.println("No");
				return;
			}
		}
		out.println("Yes");

	}

	void run() throws Exception
	{
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
	}

	public static void main(String[] args) throws Exception
	{ new Main().run(); }

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf)
		{
			ptrbuf = 0;
			try
			{ lenbuf = is.read(inbuf); }
			catch (IOException e)
			{ throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c)
	{ return !(c >= 33 && c <= 126); }
	private int skip()
	{ int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd()
	{ return Double.parseDouble(ns()); }
	private char nc()
	{ return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b)))
		{ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b)))
		{
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}

		while(true)
		{
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-')
		{
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9')
			{
				num = num * 10 + (b - '0');
			}else
			{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o)
	{ System.out.println(Arrays.deepToString(o)); }
}