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
3
3
3
1
1
1
1
3
3
3
3
1
2
3
1
2
2
2
3
3
2
1
3
3
1
2
3
1
1
1
2
2
2
3
1
1
1
1
1
1
3
2
2
2
2
2
2
3
1
2
2
2
2
2
3
3
2
1
1
 3
3
2
2
 3
3
2
3
 2
3
3
 3
2
2
1
 5
1
1
2
2
3
 3
1
3
1
 3
1
1
3

YES
 NO
 NO
 NO
 YES
 NO
 YES
 YES
 NO
 NO
 NO
 YES
 NO
 NO
 YES
 YES
 YES
 NO
 YES
 YES
 NO
 NO
 NO
 NO
 NO
 YES
 YES
 YES
 NO
 NO
 NO
 YES
 NO
 NO
 NO

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


public class Main {
    static Reader in;
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        in = new Reader();
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        new Solution();
        out.close();
    }
    
    static class Solution {
        Solution() {
            int n = in.nextInt();
            int[] games = new int[n];
            for(int i=0; i<n; i++) {
                games[i] = in.nextInt();
            }
            
            int alex = 0;
            int bob = 0;
            int carl = 0;
            
            boolean flag = false;
            boolean avoid = false;

            if(games[0]==1)
                ++bob;
            else if(games[0]==2)
                ++alex;
            else if(games[0]==3) {
                flag = true;
                avoid = true;
            }
            
            if(!avoid) {
                for(int i=1; i<n; i++) {
                    if(bob>1 || carl>1 || alex>1) {
                        flag = true;
                        break;
                    }
                    if(bob!=0 && carl==0 && alex==0) {
                        if(bob>1 || carl>1 || alex>1) {
                            flag = true;
                            break;
                        } else if(bob==1 && games[i]==2) {
                            flag = true;
                            break;
                        } else {
                            if(games[i]==3) {
                                --bob;
                                ++alex;
                            } else if(games[i]==1) {
                                --bob;
                                ++carl;
                            }
                        }
                    } else if(alex!=0 && bob==0 && carl==0) {
                        if(bob>1 || carl>1 || alex>1) {
                            flag = true;
                            break;
                        } else if(alex==1 && games[i]==1) {
                            flag = true;
                            break;
                        } else {
                            if(games[i]==2) {
                                --alex;
                                ++carl;
                            } else if(games[i]==3) {
                                --alex;
                                ++bob;
                            }
                        }
                    } else if(carl!=0 && bob==0 && alex==0) {
                        if(bob>1 || carl>1 || alex>1) {
                            flag = true;
                            break;
                        } else if(carl==1 && games[i]==3) {
                            flag = true;
                            break;
                        } else {
                            if(games[i]==1) {
                                --carl;
                                ++bob;
                            } else if(games[i]==2) {
                                --carl;
                                ++alex;
                            }
                        }
                    }
                }
            }
            if(flag)
                out.println("NO");
            else
                out.println("YES");
        }
    }

    static class Reader {
        public BufferedReader br;
        public StringTokenizer st;
        public Reader() {
            br = new BufferedReader(new InputStreamReader(System.in));
            
        }
        public String next() {
            while(st==null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public char nextChar() {
            return next().charAt(0);
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public double nextDouble() {
            return Double.parseDouble(next());
        }
        public String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }
    }
}