import java.util.Scanner;

public class MagicSpheres {
    public static void main (String[] args){
        Scanner scan;
        scan = new Scanner(System.in);
        while(true){
            try{
            //String stones = scan.nextLine();
           // String needed = scan.nextLine();
          //  String[] l = stones.split(" ");
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();
          //   String[] m = needed.split(" ");
            int ac = scan.nextInt();
            int bc = scan.nextInt();
            int cc = scan.nextInt();
            if (a == ac && b==bc && c==cc){
                System.out.println("Yes");
            }
            else if(a> ac && b > bc && c>cc){
                System.out.println("Yes");
                continue;
            }else if (a< ac && b < bc && c<cc){
                System.out.println("No");
                continue;
            }
            int auxI = a -ac;
            int auxII = b -bc;
            int auxIII = c -cc;
            if(auxI < 0 && auxII <0 ){
                System.out.println("No");
                continue;
            }else if(auxI < 0 && auxIII <0 ){
                System.out.println("No");
                continue;
            }else if(auxII < 0 && auxIII <0 ){
                System.out.println("No");
                continue;
            }

            if(auxI <0){
                if(auxII < auxIII){
                    if(auxII > auxI)System.out.println("Yes");
                    else System.out.println("No");
                }else{
                    if(auxIII > auxI)System.out.println("Yes");
                    else System.out.println("No");
                }
            }else if(auxII <0){
                if(auxI < auxIII){
                    if(auxI > auxIII)System.out.println("Yes");
                    else System.out.println("No");
                }else{
                    if(auxIII > auxII)System.out.println("Yes");
                    else System.out.println("No");
                }
            }else if(auxIII <0){
                if(auxI < auxII){
                    if(auxI > auxIII)System.out.println("Yes");
                    else System.out.println("No");
                }else{
                    if(auxII > auxIII)System.out.println("Yes");
                    else System.out.println("No");
                }
            }

        }catch (Exception e){}
        }

    }
}


import java.util.Scanner;

public class MagicSpheres {
    public static void main (String[] args){
        Scanner scan;
        scan = new Scanner(System.in);
        while(true){
            try{
            String stones = scan.nextLine();
            String needed = scan.nextLine();
            String[] l = stones.split(" ");
            int a = Integer.parseInt(l[0]);
            int b = Integer.parseInt(l[1]);
            int c = Integer.parseInt(l[2]);
             String[] m = needed.split(" ");
            int ac = Integer.parseInt(m[0]);
            int bc = Integer.parseInt(m[1]);
            int cc = Integer.parseInt(m[2]);
            if(a> ac && b > bc && c>cc){
                System.out.println("Yes");
                continue;
            }else if (a< ac && b < bc && c<cc){
                System.out.println("No");
                continue;
            }
            int auxI = a -ac;
            int auxII = b -bc;
            int auxIII = c -cc;
            if(auxI < 0 && auxII <0 ){
                System.out.println("No");
                continue;
            }else if(auxI < 0 && auxIII <0 ){
                System.out.println("No");
                continue;
            }else if(auxII < 0 && auxIII <0 ){
                System.out.println("No");
                continue;
            }

            if(auxI <0){
                if(auxII < auxIII){
                    if(auxII > auxI)System.out.println("Yes");
                    else System.out.println("No");
                }else{
                    if(auxIII > auxI)System.out.println("Yes");
                    else System.out.println("No");
                }
            }else if(auxII <0){
                if(auxI < auxIII){
                    if(auxI > auxIII)System.out.println("Yes");
                    else System.out.println("No");
                }else{
                    if(auxIII > auxII)System.out.println("Yes");
                    else System.out.println("No");
                }
            }else if(auxIII <0){
                if(auxI < auxII){
                    if(auxI > auxIII)System.out.println("Yes");
                    else System.out.println("No");
                }else{
                    if(auxII > auxIII)System.out.println("Yes");
                    else System.out.println("No");
                }
            }

        }catch (Exception e){}
        }

    }
}


import java.util.*;
public class Magic_sphere{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int[] arr=new int[3];

        int[] arr1=new int[3];
        int i=0;
        for(i=0;i<3;i++){
            arr[i]=sc.nextInt();
        }
        for(i=0;i<3;i++){
            arr1[i]=sc.nextInt();
        }
        int temp=0;
        for(i=0;i<3;i++){
            while((arr[i]-1)>arr1[i]){
                temp++;
                arr[i]=arr[i]-2;
            }
        }
        for(i=0;i<3;i++){
            while(arr[i]<arr1[i]){
                temp--;
                arr1[i]++;
            }
        }
        if(temp>=0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}


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

public class Main {
  int x, y, z;
  int[] xyz;

  int sum(int[] a) {
    int res = 0;
    for ( int i = 0; i < a.length; ++i ) {
      res += a[ i ];
    }
    return res;
  }

  boolean dfs(int[] abc, int s) {
    if ( sum(abc) < x + y + z ) {
      return false;
    }
    if ( sum(abc) == x + y + z ) {
      int a = abc[ 0 ];
      int b = abc[ 1 ];
      int c = abc[ 2 ];
      return a == x && b == y && c == z;
    }
    boolean res = false;

    int st = Math.max(0, (abc[ s ] - xyz[ s ] + 1) / 4);
    for ( int i = st; i * 2 <= abc[ s ]; ++i ) {
      for ( int j = 0; j < 3; ++j ) {
        if ( s == j ) {
          continue;
        }
        int[] next = Arrays.copyOf(abc, 3);
        next[ s ] -= i * 2;
        next[ j ] += i;
        res |= dfs(next, (s + 1) % 3);
      }
    }

    return res;
  }

  void run() {
    int a = ni();
    int b = ni();
    int c = ni();

    x = ni();
    y = ni();
    z = ni();
    xyz = new int[]{ x, y, z };

    System.out.println(dfs(new int[]{ a, b, c }, 0) ? "Yes" : "No");
  }

  Scanner sc;

  Main() {
    sc = new Scanner(System.in);
  }

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

  int ni() {
    return sc.nextInt();
  }

  long nl() {
    return sc.nextLong();
  }

  void debug(Object... os) {
    System.err.println(Arrays.deepToString(os));
  }
}


package ch13;

import java.util.Scanner;
public class MinimumK {
	public static void main(String[] args)
	{
		Scanner input=new Scanner(System.in);
		int num=input.nextInt();
		int[] arr=new int[num];
		int minK=-999;
		int sum=0;
		for (int i=0;i<arr.length;++i)
		{
			arr[i]=input.nextInt();
			sum+=arr[i];
			if (minK < arr[i])
				minK=arr[i];
		}
		boolean flag=false;

		while(!flag)
		{
			int sum1=0;
			for (int i=0;i<arr.length;++i)
				sum1+=minK-arr[i];
			if (sum1>sum)
				flag=true;
			else
				minK++;
		}
		System.out.println(minK);
	}
}


import java.io.IOException;

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

import java.io.PrintWriter;

import java.util.StringTokenizer;

public class Main {

    static Scanner s = new Scanner();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        int n = s.nextInt(), max = 0, sum = 0, u;
        for(int i = 0; i < n; i++) {
            int a = s.nextInt();
            sum += a;
            max = Math.max(max, a);
        }
        u = 2 * sum - max * n;
        out.print(Math.max(max, max + u / n + u / Math.abs(u)));
        out.close();
    }

    static class Scanner {
        BufferedReader in;
        StringTokenizer s;

        public Scanner() {
            in = new BufferedReader(new InputStreamReader(System.in));
            s = new StringTokenizer("");
        }

        public String next() throws IOException {
            if(!s.hasMoreTokens())
                s = new StringTokenizer(in.readLine());
            return s.nextToken();
        }

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


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

public class Hello {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		InputReader sc = new InputReader(System.in);
		int n = sc.nextInt();
		int sum = 0, max = 0;
		for (int i = 0; i < n; i++) {
			int num=sc.nextInt();
			sum += sc.nextInt();
			if (num > max) {
				max = num;
			}
		}
		System.out.println(Math.max(max, (2*sum / n) + 1));
	}

	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());
		}
	}
}


package com.company;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int mx = 0, sum = 0;
        StringTokenizer st = new StringTokenizer(br.readLine());
        for(int i = 0; i < n; i++){
            int a = Integer.parseInt(st.nextToken());
            mx = Math.max(mx, a);
            sum += a;
        }

        sum *= 2;
        sum += n;
        sum /= n;

        System.out.println(Math.max(sum,mx));
    }
}


package kattis;

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

public class AE23 {

	public static void main(String[] args) throws IOException {
		IO io = new IO(System.in);
		int x1 = io.nextInt();
		int y1 = io.nextInt();
		int x2 = io.nextInt();
		int y2 = io.nextInt();
		int x = io.nextInt();
		int y = io.nextInt();
		boolean err = false;
		err = err || (x1-x2)%x != 0;
		err = err || (y1-y2)%y != 0;
		err = err || ((y1-y2)/y + (x1-x2)/x)%2 != 0;
		io.println(err?"NO":"YES");
		io.close();
	}

	static class IO extends PrintWriter {
		static BufferedReader r;
		static StringTokenizer t;

		public IO(InputStream i) {
			super(new BufferedOutputStream(System.out));
			r = new BufferedReader(new InputStreamReader(i));
			t = new StringTokenizer("");
		}

		public String next() throws IOException {
			while (!t.hasMoreTokens()) {
				t = new StringTokenizer(r.readLine());
			}
			return t.nextToken();
		}

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

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

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


import java.util.Scanner;

/**
 *
 * @author Public
 */
public class Treasure_hunt {
    public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int x1=sc.nextInt();
    int y1=sc.nextInt();
    int x2=sc.nextInt();
    int y2=sc.nextInt();
    int x=sc.nextInt();
    int y=sc.nextInt();
    if(x1==x || y1==y){}
    else{
    if(x1<x2){
    x1=x1+x;
    }
    else if(x1>x2){
    x1=x1-x;}
    if(y1<y2){
    y1=y1+y;
    }
    else if(y1>y2){
    y1=y1-y;
    }}
    if(x2%x1==0 && y2%y1==0){
    System.out.println("YES");
    }
    else{
        System.out.println("NO");
    }
    }
}


package cf817;

import java.util.Scanner;

public class MainA {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] array = in.nextLine().split(" ");
		int x1 = Integer.parseInt(array[0]);
		int y1 = Integer.parseInt(array[1]);
		int x2 = Integer.parseInt(array[2]);
		int y2 = Integer.parseInt(array[3]);
		array = in.nextLine().split(" ");
		int x = Integer.parseInt(array[0]);
		int y = Integer.parseInt(array[1]);

		if(Math.abs(x1 - x2) % x != 0 || Math.abs(y1 - y2) % y != 0) {
			System.out.println("NO");
		}else {
			int xstep = Math.abs((x1 - x2)) / x;
			int ystep = Math.abs((y1 - y2)) / y;
			if((xstep - ystep) % 2 != 0) {
				System.out.println("NO");
			}else {
				System.out.println("YES");
			}
		}

		in.close();
	}
}


import java.util.Scanner;

/**
 * Created by abgupta on 6/15/17.
 */
public class C_817_A {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();

        int dx = Math.abs(x1-x2);
        int dy = Math.abs(y1-y2);

        int x = in.nextInt();
        int y = in.nextInt();

        if (dx % x != 0 || dy % y != 0) {
            System.out.println("No");
            return;
        }

        int maxv = 200000;

        int d1 = dx/x;
        int d2 = dy/y;

        for(int s1=0;s1<maxv;s1++) {
            int r1 = s1+d1;
            for(int s2=0;s2 + s2 + d2 <= r1+s1;s2++) {
                int r2 = s2+d2;
                if (r1+s1 == r2+s2) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");

    }

}


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

public class Main {

    public static Scanner scan = new Scanner(System.in);

    public static final int N = 150000;

    public static void main(String[] args) throws IOException  {
        //File input = new File("D:/java.inp");
        File input = new File("");
        BufferedReader cin = new BufferedReader(new FileReader(input));
        String s = cin.readLine(), t = cin.readLine();
        int l = 0, r = 0, n = s.length(), x = 0;
        for (int i=0;i<n;i++)
            if (s.charAt(i) == '|') {
                x = i;
                break;
            }
        l = x;
        r = n-x-1;
        int d = t.length() - Math.abs(r-l);
        if (d >= 0 && d%2 == 0) {
            StringBuilder y = new StringBuilder(s);
            if (l < r) {
                y.insert(x, t.substring(0, r-l));
                x += r-l;
            }
            else
                y.append(t.substring(0, l-r));
            int c = Math.abs(r-l);
            y.insert(x, t.substring(c, c+d/2));
            y.append(t.substring(c+d/2));
            System.out.println(y);
        }
        else
            System.out.print("Impossible");
    }

}


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

public class CF {

	void solve() {
		String[] s = in.next().split("\\|");
		String s2 = in.next();
		int total = s[0].length() + s[1].length() + s2.length();
		if (total % 2 == 1) {
			out.println("Impossible");
			return;
		}
		int need = total / 2;
		if (s[0].length() > need || s[1].length() > need) {
			out.println("Impossible");
			return;
		}
		int it = 0;
		out.print(s[0]);
		for (int i = 0; i < need - s[0].length(); i++) {
			out.print(s2.charAt(it++));
		}
		out.print("|" + s[1]);
		for (int i = 0; i < need - s[1].length(); i++)
			out.print(s2.charAt(it++));
	}

	FastScaner in;
	PrintWriter out;

	void run() {
		in = new FastScaner(System.in);
		out = new PrintWriter(System.out);

		solve();

		out.close();
	}

	void runWithFiles() {
		in = new FastScaner(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		solve();

		out.close();
	}

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

	class FastScaner {
		BufferedReader br;
		StringTokenizer st;

		FastScaner(InputStream is) {
			br = new BufferedReader(new InputStreamReader(is));
		}

		FastScaner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

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

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

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

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


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

/**
 *
 * @author Ahmed
 */
public class Test {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     *
     *
     *
     */
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

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

        String w1 = in.readLine();
        String w2 = in.readLine();
        boolean k = true;
        int z = 0, n = 0;
        for (int i = 0; i < w1.length(); i++) {
            if (k) {

                if (w1.charAt(i) == '|') {
                    k = false;
                    continue;
                }
                z++;
            } else if (!k) {
                n++;
            }

        }
        if (z == n + w2.length()) {
            out.write(w1 + w2);
        } else if (n == z + w2.length()) {
            out.write(w2 + w1);
        } else if (((n + z + w2.length()) & 1) == 0) {
            String zz = w2.substring(0, ((n + z + w2.length()) / 2) - z);
            String nn = w2.substring(((n + z + w2.length()) / 2) - z);
            if (zz.length() + z != (n + z + w2.length()) / 2 || nn.length() + n != (n + z + w2.length()) / 2) {
              out.write("Impossible");

            } else {
                out.write(zz + w1 + nn);
            }

        } else {
            out.write("Impossible");
        }
        out.flush();
    }

}


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

public class A244 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String s = I.readLine();
        StringBuffer x = new StringBuffer(I.readLine());
        char ss[] = s.toCharArray();
        boolean z = false,a=false;
        String _1 = "";
        String _2 = "";
        for (int i = 0; i < ss.length; i++) {
            if (ss[i] == '|') {
                z = true;
                continue;
            }
            if (!z) {
                _1 += ss[i];
            } else {
                _2 += ss[i];
            }
        }
        if (_1.length() < _2.length() && _1.length() + x.length() == _2.length()) {

            System.out.println(_1 + x + "|" + _2);

        } else if (_1.length() > _2.length() && _2.length() + x.length() == _1.length()) {

            System.out.println(_1 + "|" + _2 + x);

        } else{
            while(x.length()>0){
                if(_1.length()>_2.length()){
                    _2=_2+x.charAt(0);
                    x.deleteCharAt(0);
                }
                if(_1.length()<_2.length()){
                     _1=_1+x.charAt(0);
                    x.deleteCharAt(0);
                }
                if(_1.length()==_2.length()&&x.length()%2==0&&x.length()>0){
                     _1=_1+x.charAt(0);
                    x.deleteCharAt(0);
                }

            }
            if(_1.length()==_2.length()&&x.length()==0)
                 System.out.println(_1 + "|" + _2);
            else
                System.out.println("Impossible");

        }

    }
}


package com.example.hackerrank;

import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.IOException;
import java.math.BigInteger;
import java.util.*;
import java.util.stream.Stream;

/**
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Hackerrank{
    public static InputStream inputStream = System.in;
    public static FastReader in = new FastReader(inputStream);
    public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
    public static int maxval = Integer.MAX_VALUE;
    public static int minval = Integer.MIN_VALUE;
    public static void main(String[] args)throws java.lang.Exception
    {
        new Hackerrank().run();
        out.close();
    }
    void run() throws java.lang.Exception
    {
        int[] a = new int[12];
        a[0] = a[2] = a[4] = a[6] = a[7] = a[9] = a[11] = 31;
        a[1] = 28;
        a[3] = a[5] = a[8] = a[10] = 30;
        int m = ni() - 1, d = ni();
        if(a[m] == 31){
            if(d == 7 || d == 6){
                out.println("6");
            } else {
                out.println("5");
            }
        } else if(a[m] == 30){
            if(d == 7) {
                out.println("6");
            } else {
                out.println("5");
            }
        } else {
            if(d == 1){
                out.println("4");
            } else {
                out.println("5");
            }
        }
    }
    private static int ni(){
        return in.nextInt();
    }
    private static long nl(){
        return in.nextLong();
    }
    private static String ns(){
        return in.nextString();
    }
    private static char nc(){
        return in.nextCharacter();
    }
    private static double nd(){
        return in.nextDouble();
    }

    private static char[] ns(int n)
    {
        char[] a = new char[n];
        for(int i=0;i<n;i++) a[i] = nc();
        return a;
    }

    private static 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 static int[] na(int n)
    {
        int[] a = new int[n];
        for(int i=0;i<n;i++) a[i] = ni();
        return a;
    }

    private static long[] nal(int n)
    {
        long[] a = new long[n];
        for(int i=0;i<n;i++) a[i] = nl();
        return a;
    }
    //out.println(Arrays.stream());
}

class FastReader{
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public FastReader(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 peek(){
        if (numChars == -1){
            return -1;
        }
        if (curChar >= numChars){
            curChar = 0;
            try{
                numChars = stream.read (buf);
            } catch (IOException e){
                return -1;
            }
            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==','){
                c = read();
            }
            if (c < '0' || c > '9'){
                throw new InputMismatchException ();
            }
            res *= 10;
            res += c - '0';
            c = read ();
        } while (!isSpaceChar (c));
        return res * sgn;
    }

    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 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 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;
    }

    private String readLine0(){
        StringBuilder buf = new StringBuilder ();
        int c = read ();
        while (c != '\n' && c != -1){
            if (c != '\r'){
                buf.appendCodePoint (c);
            }
            c = read ();
        }
        return buf.toString ();
    }

    public String nextLine(){
        String s = readLine0 ();
        while (s.trim ().length () == 0)
            s = readLine0 ();
        return s;
    }

    public String nextLine(boolean ignoreEmptyLines){
        if (ignoreEmptyLines){
            return nextLine ();
        }else{
            return readLine0 ();
        }
    }

    public BigInteger nextBigInteger(){
        try{
            return new BigInteger (nextString());
        } catch (NumberFormatException e){
            throw new InputMismatchException ();
        }
    }

    public char nextCharacter(){
        int c = read ();
        while (isSpaceChar (c))
            c = read ();
        return (char) c;
    }

    public double nextDouble(){
        int c = read ();
        while (isSpaceChar (c))
            c = read ();
        int sgn = 1;
        if (c == '-'){
            sgn = -1;
            c = read ();
        }
        double res = 0;
        while (!isSpaceChar (c) && c != '.'){
            if (c == 'e' || c == 'E'){
                return res * Math.pow (10, nextInt ());
            }
            if (c < '0' || c > '9'){
                throw new InputMismatchException ();
            }
            res *= 10;
            res += c - '0';
            c = read ();
        }
        if (c == '.'){
            c = read ();
            double m = 1;
            while (!isSpaceChar (c)){
                if (c == 'e' || c == 'E'){
                    return res * Math.pow (10, nextInt ());
                }
                if (c < '0' || c > '9'){
                    throw new InputMismatchException ();
                }
                m /= 10;
                res += (c - '0') * m;
                c = read ();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted(){
        int value;
        while (isSpaceChar (value = peek ()) && value != -1)
            read ();
        return value == -1;
    }
    public SpaceCharFilter getFilter(){
        return filter;
    }

    public void setFilter(SpaceCharFilter filter){
        this.filter = filter;
    }

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


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

public class Petr {

	public static void main(String[] args) throws NumberFormatException, IOException {

		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int m = Integer.parseInt(reader.readLine());
		int d = Integer.parseInt(reader.readLine());

		int brDana,brTjedana=0;

		if( (m<=7 && m%2==1) || (m>=8 && m%2==0) )
			brDana=31;
		else if( m == 2 )
			brDana=28;
		else
			brDana=30;

		brDana = brDana - (7-d) -1;
		brTjedana++;

		for(;brDana>0;brDana-=7)
			brTjedana++;

		System.out.println(brTjedana);
	}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class A {
	public static void main(String[] args) throws FileNotFoundException {
		Scanner in = new Scanner(System.in);

		int m = in.nextInt();
		int d = in.nextInt();

		int md = 0;
		if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
			md = 31;
		else if (m == 2)
			md = 28;
		else
			md = 30;

		d = 7 - (7 - d + 1);
		System.out.println((d + md) / 6);

		in.close();
	}
}


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

public class temp{

	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		OutputWriter out = new OutputWriter(System.out);
		int n = in.readInt();
		int m = in.readInt();
		if(n == 1 || n == 3 || n == 5 || n == 7 || n == 8 || n == 10 || n == 12 ){
			if(m >= 5){
				System.out.println(6);
			}else{
				System.out.println(5);
			}
		}else if(n == 2){
			if(m != 1){
				System.out.println(5);
			}else{
				System.out.println(4);
			}
		}else{
			if(m > 6){
				System.out.println(6);
			}else{
				System.out.println(5);
			}
		}

		out.close();
	}

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

		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 long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			long 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 readInt() {
			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 readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuffer res = new StringBuffer();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

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

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

	private static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(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 printLine(Object... objects) {
			print(objects);
			writer.println();
		}

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


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

public class Codeforces {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        n = Reader.nextInt();
        int limt = ((n+"").length() / 2) * 2;

        lucky(0, limt, "");

        System.out.println(min);

    }
    static long min = Long.MAX_VALUE;
    static int n;

    public static void lucky(int i, int lim, String num){
        if(i == lim){

            int c = 0;

            for(int j = 0; j < num.length(); j++)
                if(num.charAt(j) == '4')
                    c++;

            if(c != lim / 2)
                return;

            long x = Long.parseLong(num);

            if(x >= n && x < min)
                min = x;

            return;
        }

        lucky(i+1, lim, num + '4');
        lucky(i+1, lim, num + '7');
    }
}

class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /**
     * call this method to initialize reader for InputStream
     */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    /**
     * get next word
     */
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

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

    static byte nextByte() throws IOException {

        return Byte.parseByte(next());
    }

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

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


import java.util.Scanner;

public class B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			int min = sc.nextInt();
			int n = 0;
			while(true) {
				n = next(n);
				if(same(n) && n>=min) {
					System.out.println(n);
					break;
				}
			}
		}
	}

	private static int next(int n) {
		if(n==0) return 47;
		StringBuffer sb = new StringBuffer(String.valueOf(n));
		for(int i=sb.length()-1;i>=0;i--) {
			if(sb.charAt(i)=='7') {
				sb.setCharAt(i, '4');
			} else {
				sb.setCharAt(i, '7');
				break;
			}
		}
		if(sb.indexOf("7")==-1) sb.insert(0, "4");
		return Integer.valueOf(sb.toString());
	}

	private static boolean same(int n) {
		int four = 0, seven = 0;
		while(n>0) {
			int d = n%10;
			n/=10;
			if(d==4) four++;
			else if(d==7) seven++;
		}
		return four==seven;
	}
}


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

public class Main
{
	public static void main(String adp[])throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ns=""+n;
		if(ns.charAt(0)=='8'||ns.charAt(0)=='9')
		{
			int len=ns.length();
			String ans="";
			int i=1;
			while(i<=len/2+1)
			{
				ans+="4";
				i++;
			}
			while(i<=len+1)
			{
				ans+="7";
				i++;
			}
			if((len+1)%2!=0)
			{
				ans+="7";
			}
			System.out.println(ans);
			return;
		}
		int len=ns.length();
		int j;
		int no4=0,no7=0;
		for(j=0;j<len;j++)
		{
			if(!(Integer.parseInt(""+ns.charAt(j))==7 || Integer.parseInt(""+ns.charAt(j))==4))
			{
				break;
			}
			else if(Integer.parseInt(""+ns.charAt(j))==7)
			{
				no7++;
			}
			else if(Integer.parseInt(""+ns.charAt(j))==4)
			{
				no4++;
			}
		}
		String ans=ns.substring(0,j);
		if(Integer.parseInt(""+ns.charAt(j))>4)
		{
			ans+="7";
			no7++;
		}
		else
		{
			ans+="4";
			no4++;
		}
		int fno4,fno7;
		if(len%2==0)
		{
			fno4=len/2;
			fno7=len/2;
		}
		else
		{
			fno4=(len/2)+1;
			fno7=(len/2)+1;
		}
		int left4=fno4-no4;
		int left7=fno7-no7;
		while(left4>0)
		{
			ans+="4";
			left4--;
		}
		while(left7>0)
		{
			ans+="7";
			left7--;
		}
		System.out.println(ans);

	}
}


import java.util.Scanner;

public class B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()) {
			long nn = sc.nextLong();
			long n = nn;
			String binary = "";
			while(n>0) {
				long d = n%10;
				n /= 10;
				if(d>7) {
					binary = "0" + binary;
					n++;
//				} else if(d>4) {
//					binary = "1" + binary;
				} else {
					binary = "0" + binary;
				}
			}
			int all = binary.length();
			if(all%2!=0) {
				binary = "0" + binary;
				all++;
			}
			int b = Integer.valueOf(binary, 2);
			while(true) {
				if(Integer.bitCount(b)==all/2) {
					String s = Integer.toBinaryString(b);
					while(s.length()<all) s = '0' + s;
					long ans = Long.valueOf(s.replace('0', '4').replace('1', '7'));
					if(ans<nn) {
						b++;
						continue;
					}
					System.out.println(ans);
					break;
				} else {
					b++;
				}
			}
		}
	}
}


import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

    private static final double EPS = 1e-9;

    public static void main(String[] args) throws Exception {
        FastScanner fastScanner = new FastScanner(System.in);
        PrintWriter printWriter = new PrintWriter(System.out);
        Main main = new Main();
        main.solveA(fastScanner, printWriter);
        printWriter.close();

    }

    static class Node {
        int num, pos;

        public Node(int num, int pos) {
            this.num = num;
            this.pos = pos;
        }
    }

    public void solveC(FastScanner scanner, PrintWriter writer) {

    }

    HashMap<String, Integer> dpMap;

    public int dp(int maxLen, String fromStr, ArrayList<String> keyList, ArrayList<String> valueList) {
        if (fromStr.length() == maxLen) return 1;
        if (dpMap.containsKey(fromStr))
            return dpMap.get(fromStr);
        char first = fromStr.charAt(0);
        int cnt = 0;
        for (int i = 0; i < valueList.size(); i++) {
            if (valueList.get(i).charAt(0) == first) {
                cnt += dp(maxLen, keyList.get(i) + fromStr.substring(1), keyList, valueList);
            }
        }
        dpMap.put(fromStr, cnt);
        return dpMap.get(fromStr);
    }

    public void solveB(FastScanner scanner, PrintWriter writer) {
        int n = scanner.nextInt();
        int q = scanner.nextInt();

        ArrayList<String> keyList = new ArrayList<>();
        ArrayList<String> valueList = new ArrayList<>();
        dpMap = new HashMap<>(1000);
        for (int i = 0; i < q; i++) {
            keyList.add(scanner.next());
            valueList.add(scanner.next());
        }

        int ans = dp(n, "a", keyList, valueList);
        writer.printf("%d\n", ans);

    }

    public void solveA(FastScanner scanner, PrintWriter writer) {
        int n = scanner.nextInt();
        int nums[] = new int[n];
        int hash[] = new int[1005];
        for (int i = 0; i < n; i++) {
            int x = scanner.nextInt();
            if(hash[x]==0) {
                nums[i] = x;
                hash[x] = 1;
            }
        }

        Arrays.sort(nums);
        boolean flag = false;
        for (int i = 2; i < n; i++) {
            if ((nums[i] == (nums[i - 1] + 1)) && (nums[i - 1] == (nums[i - 2] + 1))) {
                flag = true;
                break;
            }
        }
        if (flag)
            writer.printf("YES\n");
        else
            writer.printf("NO\n");

    }

    static class Point {
        long x, y;

        public Point(long x, long y) {
            this.x = x;
            this.y = y;
        }
    }

    long twoTimesAreaOfTriangle(Point a, Point b, Point c) {
        long ar = a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y);
        if (ar < 0) ar = ar * (-1);
        return ar;
    }

    boolean isCisOnAB(Point a, Point b, Point c) {
        long cross = (c.y - a.y) * (b.x - a.x) - (c.x - a.x) * (b.y - a.y);
        if (cross != 0) return false;
        long dotproduct = (c.x - a.x) * (b.x - a.x) + (c.y - a.y) * (b.y - a.y);
        if (dotproduct < 0)
            return false;
        long squaredlengthba = (b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y);
        if (dotproduct > squaredlengthba) return false;

        return true;

    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                    return next();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

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

    }

}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main{
  public static void main(String []args)throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    //Scanner input = new Scanner(System.in);
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
    StringTokenizer st;
    int n = Integer.parseInt(br.readLine());
    int a [] = new int [1000] ;
    st = new StringTokenizer(br.readLine());
    for(int  i = 0 ; i <  n ; i++)
     a[Integer.parseInt(st.nextToken())]++;
    int ans = 0 ;
    int c = 0 ;
    for(int i = 0 ; i < 1000 ; i++){
      if(c==3){
        System.out.println("YES");
        return;
      }
      if(a[i]>0){
        c++;
      }
      else
        c = 0 ;
      }

    System.out.println("NO");
  }
}


import java.util.*;

public class Q1 {

	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		ArrayList<Integer> arr = new ArrayList<Integer>();
		for(int i=0;i<n;i++) {
			arr.add(scan.nextInt());
		}
		arr.sort(null);
		int flag=0;
		int i=0;
		while(i<n-2) {
			int j=i+1;
			while(j<n-2) {
				if(arr.get(j)!=arr.get(i)) {
					break;
				}
				j++;
			}
			int k=j+1;
			while(k<n-2) {
				if(arr.get(k)!=arr.get(j)) {
					break;
				}
			}
			if(((arr.get(j)-arr.get(i))<=2)&&((arr.get(k)-arr.get(j))<=2)
					&&((arr.get(k)-arr.get(i))<=2)){
				System.out.println("YES");
				flag=1;
				break;
			}
		}
		if(flag==0) System.out.println("NO");
	}

}


import java.util.*;
public class candies{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        if(a==d+b+c)
            System.out.println("YES");
        else if(b==a+d+c)
            System.out.println("YES");
        else if(c==a+b+d)
            System.out.println("YES");

        else if(d==a+b+c)
            System.out.println("YES");

        else if(a+b==c+d)
            System.out.println("YES");

        else if(a+c==b+d)
            System.out.println("YES");
        else if(a+d==b+c)
            System.out.println("YES");
        else

            System.out.println("NO");

    }}


import java.util.Scanner;

public class main {

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);
		int x[]=new int[4];
		for(int i=0;i<x.length;i++)
			x[i]=sc.nextInt();
		if(x[0]+x[1]==x[2]+x[3])
			System.out.println("YES");
		else if(x[0]+x[2]==x[1]+x[3])
			System.out.println("YES");
		else if(x[0]+x[3]==x[1]+x[2])
			System.out.println("YES");
		else if(x[0]==x[1]+x[3]+x[2])
			System.out.println("YES");
		else if(x[1]==x[0]+x[3]+x[2])
			System.out.println("YES");
		else if(x[2]==x[1]+x[3]+x[0])
			System.out.println("YES");
		else if(x[3]==x[1]+x[0]+x[2])
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {
    FastScanner in;
    PrintWriter out;

    class Item implements Comparable{
        int num;
        int count;

        public Item(int num, int count) {
            this.num = num;
            this.count = count;
        }

        public void increaseCount(){
            count++;
        }

        public int getCount() {
            return count;
        }

        public void setNum(int num) {
            this.num = num;
        }

        public int getNum() {
            return num;
        }

        @Override
        public int compareTo(Object o) {
            return count-((Item)o).count;
        }
    }

    void solve() {
       int arr[] = new int[4];
        int sum = 0, totalSum = 0;
        for (int i = 0; i < 4; i++) {
            arr[i] = in.nextInt();
            totalSum+=arr[i];
        }

        if (totalSum%2!=0)
            out.print("NO");
        else if (find(arr,totalSum/2,0)){
            out.print("YES");
        }else {
            out.print("NO");
        }
    }

    boolean find(int arr[], int sum, int currentIndex){
        if (currentIndex>=arr.length)
            return sum==0;
        if (sum==0)
            return true;
        boolean b1 = find(arr,sum-arr[currentIndex], currentIndex+1);
        boolean b2 = find(arr,sum, currentIndex+1);
        return b1 || b2;
    }

    void run() {
        try {
            in = new FastScanner(new File("Solution.in"));
            out = new PrintWriter(new File("Solution.out"));

            solve();

            out.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    void runIO() {

        in = new FastScanner(System.in);
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    static void printArray(int arr[]){
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+", ");
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

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

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

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

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

        int[] nextIntArray(int n){
            int returnArray[] = new int[n];
            for (int i = 0; i < n; i++) {
                returnArray[i] = this.nextInt();
            }
            return returnArray;
        }

        String[] nextStringArray(int n){
            String returnArray[] = new String[n];
            for (int i = 0; i < n; i++) {
                returnArray[i] = this.next();
            }
            return returnArray;
        }

        char[] nextCharArray(int n){
            char returnArray[] = new char[n];
            for (int i = 0; i < n; i++) {
                returnArray[i] = this.next().charAt(0);
            }
            return returnArray;
        }

        long[] nextLongArray(int n){
            long returnArray[] = new long[n];
            for (int i = 0; i < n; i++) {
                returnArray[i] = this.nextLong();
            }
            return returnArray;
        }
    }

    public static void main(String[] args) {
        new A().runIO();
    }
}


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

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

        int[] arr = new int[200000000];

        for (int i = 0; i < 4; ++i) {
            arr[i] = sc.nextInt();
        }

        Arrays.sort(arr);

        if (arr[3] == (arr[0] + arr[1] + arr[2]) ||
                (arr[0] + arr[3]) == (arr[1] + arr[2])) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] paper = new String[4];

        for(int i = 0; i < 4; ++i) {
            paper[i] = br.readLine();
        }

        boolean isFound = false;
        for(int i = 1; i < 4; ++i) {
            for(int j = 1; j < 4; ++j) {
                if((paper[i-1].charAt(j-1) == paper[i-1].charAt(j)) && (paper[i-1].charAt(j) == paper[i].charAt(j-1))) {
                    System.out.println("YES");
                    isFound = true;
                }
                if(isFound)
                    break;
            }
            if(isFound)
                break;
        }

        if(!isFound)
            System.out.println("NO");

        System.exit(0);
    }
}


import java.util.Scanner;

public class A {
public static void main(String[] args) {
    Scanner in = new Scanner ( System.in );
    String a;
    int s=0,flag=0;
    char x='.';
    char y='#';
    char[][] b=new char[4][4];
    for(int i=0;i<4;i++){
        a=in.next();
        for(int j=0;j<4;j++){
            b[i][j]=a.charAt(j);
            }
    }
    for(int i=0;i<4;i++){

        for(int j=0;j<4;j++){
            s=0;
            if(b[i][j]==x&&i<3&&j<3){
                if(b[i][j+1]==x)
                    s++;
                if(b[i+1][j]==x)
                    s++;
                if(b[i+1][j+1]==x)
                    s++;

            }
            if(b[i][j]==y&&i<3&&j<3){
                if(b[i][j+1]==y)
                    s++;
                if(b[i+1][j]==y)
                    s++;
                if(b[i+1][j+1]==y)
                    s++;

            }
            if(s>=2){
                flag=1;
                break;
            }
        }
        if(flag==1)
            break;
    }
    if(flag==1)
        System.out.println("YES");
    else
        System.out.println("NO");
}
}


import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author sagimbekov_ma
 */
public class A287 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] a = new String[4];
        for (int i = 0; i < 4; i++) {
            a[i] = sc.nextLine();
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                int count = 0;
                for (int x = i; x < i + 2; x++) {
                    for (int y = j; y < j + 2; j++) {
                        if (a[x].charAt(y) == '#') {
                            count++;
                        }
                    }
                }
                if (count > 2) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}


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

/**
 *
 * @author Ahmed
 */
public class Test {

    /**
     * @param args the command line arguments
     * @throws java.io.IOException
     *
     *
     *
     */
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String a[] = new String[4];

        for (int i = 0; i < 4; i++) {
            a[i] = in.readLine();
        }
        int k = 0, j = 0, l = 0;
        for (int i = 0; i < 2; i++) {
            for (int t = i; t < i + 2; i++) {
                if (a[0].charAt(t) == '#') {
                    k++;
                }
                if (a[1].charAt(t) == '#') {
                    k++;
                }
            }
            for (int t = i; i < i + 2; i++) {
                if (a[1].charAt(t) == '#') {
                    j++;
                }
                if (a[2].charAt(t) == '#') {
                    j++;
                }
            }
            for (int t = i; i < i + 2; i++) {
                if (a[2].charAt(t) == '#') {
                    l++;
                }
                if (a[3].charAt(t) == '#') {
                    l++;
                }
            }
            if (k != 2 || l != 2 || j != 2) {
                out.write("YES" + "\n");
                out.flush();
                System.exit(0);
            }
        }
        out.write("NO" + "\n");
        out.flush();

    }

}


public class TheatreSquare {

    public int solve(int n, int m ,int a){
	int x = n/a + (n%a==0?0:1);
	int y = m/a + (m%a==0?0:1);
	return x*y;
    }
    public void run(String[] args){
	System.err.println( "(n,m,a)=(6,6,4) : "+(new TheatreSquare()).solve(6,6,4) );
    }
    public static void main(String[] args){
	(new TheatreSquare()).run(args);
    }
}


import java.math.BigInteger;
import java.util.Scanner;

/**
 *
 * @author Vortex
 */
public class Solution{

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

        BigInteger n = new BigInteger(sc.next());
        BigInteger m = new BigInteger(sc.next());
        BigInteger a = new BigInteger(sc.next());

        BigInteger a1 = n.divide(a);
        System.out.println("a1 after divide : "+a1.toString());

        if(!n.remainder(a).equals(BigInteger.ZERO))
        {
            a1 = a1.add(BigInteger.ONE);
        }
        BigInteger a2 = m.divide(a);
        System.out.println("a2 after divide : "+a2.toString());

        if(!m.remainder(a).equals(BigInteger.ZERO))
        {
            a2 = a2.add(BigInteger.ONE);
        }

        BigInteger answer = a1.add(a2);

        System.out.println(answer.toString());

    }
}


import java.util.Scanner;

public class TheatreSquare {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int m = scan.nextInt();
		int a = scan.nextInt();

		int x = n / a;
		if (x % a != 0) {
			x++;
		}
		int y = m / a;
		if (y % a != 0) {
			y++;
		}
		int res = x*y;

		System.err.println(res);
	}

}


import static java.lang.Math.*;
import java.util.*;
import java.io.*;
import java.util.concurrent.Executors;

public class _template implements Runnable {

	public static void main(String[] args) throws Exception {
		Locale.setDefault(Locale.US);
		Executors.newCachedThreadPool().submit(new _template());
	}

	////////////////////////////////////////////////////////////////////////////

	public void run() {
		Scanner sc = new Scanner(System.in);
		int m = sc.nextInt();
		int n = sc.nextInt();
		int a = sc.nextInt();
		System.out.println((m/a + (m%a==0 ? 0:1) ) * (n/a + (n%a==0 ? 0:1) ));

	}

}


package codeforces;
import java.util.Scanner;
public class ex5 {
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	String S [] = new String[3];

	int m=0,s=0,p=0;
	int temp=0;

	for (int i = 0; i < S.length; i++) {
		S[i]=scan.next();
		if(S[i].indexOf('m')!=-1) m++;
		if(S[i].indexOf('s')!=-1) s++;
		if(S[i].indexOf('p')!=-1) p++;
	}

	int n1 = Integer.parseInt(S[0].substring(0,1));
	int n2 = Integer.parseInt(S[1].substring(0,1));
	int n3 = Integer.parseInt(S[2].substring(0,1));

	    int d3 = Math.abs(n1-n2);
		int d4 = Math.abs(n1-n3);
		int d5 = Math.abs(n2-n3);

	if(m==3||s==3||p==3) {

		    if(d3==1&d5==1||d3==1&d4==1||d5==1&d4==1)
			System.out.println(0);
		else
		    if(d3==0&d4==0) System.out.println(0);
		else {
			if(d3<d5&d3<d4) {
			    if(d3==1||d3==2) System.out.println(1);
		        else                 System.out.println(2);
			    }
			else if (d5<d4&d5<d3){
				 if(d5==1||d5==2) System.out.println(1);
					else                 System.out.println(2);
			}
			else if(d4<d5&d4<d3) {
				if(d4==1||d4==2) System.out.println(1);
				else                 System.out.println(2);
			}

	}

	}

	if(m==2||s==2||p==2) {

		char c1 = S[0].charAt(1);
		char c2 = S[1].charAt(1);
		char c3 = S[2].charAt(1);

		if(c1==c2) {
			if(n1==n2) System.out.println(0);
			else if(d3==1||d3==2) System.out.println(1);
			else System.out.println(2);
		}
		if(c1==c3) {
			if(n1==n3) System.out.println(0);
			else if(d4==1||d4==2) System.out.println(1);
			else System.out.println(2);
		}
		if(c2==c3) {
			if(n2==n3) System.out.println(0);
			else if(d5==1||d5==2) System.out.println(1);
			else System.out.println(2);
		}
	}

	if(m==1&s==1&p==1) System.out.println(2);

}
}


package codeforces;
import java.util.Scanner;
import java.util.ArrayList;
public class ex5p {
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	String S [] = new String[3];

	int m=0,s=0,p=0;
	int temp=0;

	for (int i = 0; i < S.length; i++) {
		S[i]=scan.next();
		if(S[i].indexOf('m')!=-1) m++;
		if(S[i].indexOf('s')!=-1) s++;
		if(S[i].indexOf('p')!=-1) p++;
	}

	String a1 =S[0].substring(0,1);
	System.out.println(a1);
	int n1 = Integer.parseInt(a1);
	System.out.println(n1);

}}


//package codeforces;
import java.util.Scanner;
public class ex5 {
public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	String S1 = scan.nextLine();
	String S2 = scan.nextLine();
	String S3 = scan.nextLine();

	int m=0,s=0,p=0;
	int temp=0;

	if(S1.indexOf('m')!=0) m++;
	if(S2.indexOf('m')!=0) m++;
	if(S3.indexOf('m')!=0) m++;

	if(S1.indexOf('s')!=0) s++;
	if(S2.indexOf('s')!=0) s++;
	if(S3.indexOf('s')!=0) s++;

	if(S1.indexOf('p')!=0) p++;
	if(S2.indexOf('p')!=0) p++;
	if(S3.indexOf('p')!=0) p++;

	int n1 = Integer.parseInt(S1.substring(0));
	int n2 = Integer.parseInt(S2.substring(0));
	int n3 = Integer.parseInt(S3.substring(0));

	if(n2>n1&n2>n3) {
		temp=n2;
	    n2=n1;
	    n1=temp;
	    if(n2<n3)
	    	temp=n2;
	    n2=n3;
	    n3=temp;}

	else
		if(n1>n2&n1>n3) {
		   if(n2<n3)
		    	temp=n2;
		    n2=n3;
		    n3=temp;
	}
	else
	    if(n3>n2&n3>n1) {
	    	temp=n3;
      n3=n1;
       n1=temp;
       if(n2<n3)
      	temp=n2;
        n2=n3;
        n3=temp;}

	int d1 = Math.abs(n1-n2);
	int d2 = Math.abs(n2-n3);

	if(m==3||s==3||p==3) {

		    if(d1==1&d2==1||d1==2&d2==1||d1==1&d2==2)
			System.out.println(0);
		else
		    if(d1==0&d2==0) System.out.println(0);
		else {
			if(d1<d2) {
			    if(d1==1||d1==2) System.out.println(1);
			else                 System.out.println(2);
			    }
			else {
				 if(d2==1||d2==2) System.out.println(1);
					else                 System.out.println(2);
			}

	}
	}

	if(m==2||s==2||p==2) {
		int s1 = Integer.parseInt(S1.substring(0));
		int s2 = Integer.parseInt(S2.substring(0));
		int s3 = Integer.parseInt(S3.substring(0));

		int d3 = Math.abs(s1-s2);
		int d4 = Math.abs(s1-s3);
		int d5 = Math.abs(s2-s3);

		char c1 = S1.charAt(0);
		char c2 = S2.charAt(0);
		char c3 = S3.charAt(0);

		if(c1==c2) {
			if(s1==s2) System.out.println(0);
			else if(d3==1||d3==2) System.out.println(1);
			else System.out.println(2);
		}
		if(c1==c3) {
			if(s1==s3) System.out.println(0);
			else if(d4==1||d4==2) System.out.println(1);
			else System.out.println(2);
		}
		if(c2==c3) {
			if(s2==s3) System.out.println(0);
			else if(d5==1||d5==2) System.out.println(1);
			else System.out.println(2);
		}
	}

	if(m==1&s==1&p==1) System.out.println(2);

}
}


import java.io.*;
import java.util.*;
import java.math.*;
public class temp
{
    static FastReader s;;
    static int dp[];
    static PrintWriter out;
    static class pair
    {
        int a,b;
        pair(int x, int y)
        {
            a=x;
            b=y;
        }
    }
    public static void main(String[] args) throws IOException
    {

        s = new FastReader();
        out=new PrintWriter(System.out);
        long n = s.nl();
        int m = s.ni();
        long k = s.nl();
        Long arr[] = larr(m);
        long count = 0;
        long ans = 0;
        for (int i = 0; i < m; i++)
        {
            long x = (long)Math.ceil((arr[i]-count) / (double)k);
            int j = i;
            //println(arr[i]);
            long lcount = 0;
            while (j < m && (long)Math.ceil((arr[j] - count)/ (double)k) == x)
            {
                //println(arr[j]);
                j++;
                lcount++;

            }
            count += lcount;
            i = j-1;
            ans++;
        }
        println(ans);
        out.flush();
        out.close();

    }

    /*static int gcd(int a, int b)
    {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }

    static long lgcd(long a, long b)
    {
      if (b == 0)
        return a;
      return lgcd(b, a % b);
    }*/

    static class FastReader
    {

        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public FastReader(String file_name) throws IOException
        {
            br = new BufferedReader(new FileReader(file_name));
        }
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nl()
        {
            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 void piarr(int arr[])
    {
        int n = arr.length;
        for (int i = 0; i < n; i++)
        {
            print(arr[i]+" ");
        }
        println("");
    }

    static void plarr(long arr[])
    {
        int n = arr.length;
        for (int i = 0; i < n; i++)
        {
            print(arr[i]+" ");
        }
        println("");
    }

    static void println(Object line)
    {
        out.println(line);
    }
    static void print(Object line)
    {
        out.print(line);
    }
    static Integer[] iarr(int n)
    {
        Integer arr[]=new Integer[n];
        for(int i = 0; i < n;i++)
            arr[i]=s.ni();
        return arr;
    }

    static Long[] larr(int n)
    {
        Long arr[]=new Long[n];
        for(int i = 0; i < n;i++)
            arr[i]=s.nl();
        return arr;
    }

    static Integer[][] i2arr(int n, int m)
    {
        Integer arr[][]=new Integer[n][m];
        for(int i = 0; i < n;i++)
            for(int j = 0; j < m;j++)
                arr[i][j]=s.ni();
        return arr;
    }

    static Long[][] l2arr(int n, int m)
    {
        Long arr[][]=new Long[n][m];
        for(int i = 0; i < n;i++)
            for(int j = 0; j < m;j++)
                arr[i][j]=s.nl();
        return arr;
    }

    static char [] nc()
    {
        String str = s.next();
        char c[] = str.toCharArray();
        return c;
    }
    static char [][] n2c(int n)
    {
        char c[][] = new char[n][];
        for (int i = 0; i < n; i++)
            c[i] = s.next().toCharArray();
        return c;
    }

}


import java.util.*;
import java.lang.*;
public class a527
{

    public static void main(String ar[])
    {
        Scanner ob=new Scanner(System.in);
        long a=ob.nextLong();
        long b=ob.nextLong();
        int sum=0;
        long x=0,y=0;
        if(b==1)
        {
            System.out.println(a);
            System.exit(0);

        }
        else
        {
        while(true)
        {
            x=Math.max(a,b);
            y=Math.min(a,b);
            if(b<=0)
                break;
            sum+=1;
            b=x-y;
            a=y;
        }
        System.out.println(sum);
        }
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String ar[]) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong(), b = in.nextLong();

        long cnt = 0;
        while (Math.min(a, b) > 1 && a != b) {
            if (a > b)
                a -= b;
            else
                b -= a;

            cnt++;
        }

        if (a == b)
            System.out.println(cnt + 1);
        else
            System.out.println(Math.max(a, b) + cnt);
    }
}


import java.util.Scanner;

public class A {

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

        long a = scan.nextLong();
        long b = scan.nextLong();

        long count = 0;
        while (a > 1) {
            if (a % b == 0) {
                a /= b;
                count += a;
                break;
            } else {
                a -= b;
                if (b > a) {
                    long temp = a;
                    a = b;
                    b = temp;
                }
                count++;
            }

        }
        System.out.println(count);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
 *
2 1
2

1
2
4
8

 *
 * */

public class A_Div2_296 {
	public static void main(String[]arg) throws IOException
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(in.readLine());
		long a = Long.parseLong(st.nextToken());
		long b = Long.parseLong(st.nextToken());
		boolean cont = true;
		long na,nb,y,x;
		long  c = 0;
		if(b == 1)
			System.out.println(a);
		else
		{
		while(cont)
		{

			x = a - b;
			//System.out.println(x);
			if(x >= 0)
			{
				c++;
                y = b;
                if(x >= y)
                {
                	a = x;
                	b = y;
                }
                else
                {
                	a = y;
                	b = x;
                }
				if(a == 0 || b == 0)
					cont = false;

			}
			else
				cont = false;
		}

		System.out.println(c);
		}
	}

}


import java.util.*;

public class col
{
    public static void main(String[] args)
    {
       	Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if(n>=0)
		{
		    System.out.println(n);
		}
		else
		{
		    int a = n/10;
		    int last = n%10;
		    int b = n/100;
		    String s = String.valueOf(b)+String.valueOf(last);
		    b = Integer.parseInt(s);
		    int ans = Math.max(a,b);
		    System.out.println(-ans);
		}

    }
}


package bankaccount;

import java.util.Scanner;

/**
 *
 * @author Leonidas
 */
public class BankAccount {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("State");
        String n = sc.next();
        try {
            if (Integer.valueOf(n) < 0) {
                if (n.length()== 2) {
                    n = "0";
                }else{
                    if (n.charAt(n.length()-1) > n.charAt(n.length()-2) ) {
                        n = n.substring(0,n.length()-1);
                    }else{
                        n = n.substring(0,n.length()-2)+ n.charAt(n.length()-1);
                    }
                }
            }
            System.out.println(n);
        } catch (NumberFormatException e) {
            System.out.println("Solo se permiten numeros");
        }
    }
}


import java.util.*;

public class Main
{

   public static void main(String[] arg)
   {
       Scanner sc=new Scanner(System.in);
     long v=sc.nextLong();
     int l,i;
     String s2="",s="",s3="";
     if(v>0){
         System.out.println(v);
     }else{
         s=String.valueOf(v);
         l=s.length();
         if(Integer.valueOf(s.charAt(l-1))<=Integer.valueOf(s.charAt(l-2)))
         {
             s2+=s.charAt(l-1);
         }else{
             s2+=s.charAt(l-2);
         }
         for(i=0;i<l-2;i++){

             s3+=s.charAt(i);
         }
         s3+=(s2);
     }
    System.out.println(Integer.valueOf(s3));

   }

}


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

public class Main {
    public static void main(String[] args) {
        InputStream is = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(is);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {
    public void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int ans;
        if (n >= 0) {
            ans = n;
        }
        else {
            ans = Integer.MIN_VALUE;
            String s = "" + n;
            for (int i = 1; i < s.length(); i++) {
                String tmp = s.substring(0, i - 1) + s.substring(i + 1);
                ans = Math.max(ans, Integer.parseInt(tmp));
            }
        }
        System.out.println(ans);
    }
}

class InputReader {
    public BufferedReader reader;

    public StringTokenizer tokenizer;

    public InputReader(InputStream is) {
        reader = new BufferedReader(new InputStreamReader(is), 1 << 15);
        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 int nextInt() {
        return Integer.parseInt(next());
    }

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

}


import java.util.Scanner;

public class Div294A {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner s = new Scanner(System.in);
		int b=0;
		int w=0;

		for(int i=0;i<8;i++){
			String n = s.next();

			char[] c = n.toCharArray();
			for(int j=0;j<8;j++){
				if(c[j]=='.')continue;

				if(c[j]=='P'){
					w+=1;
				}
				else if(c[j]=='p')
					b+=1;

				else if(c[j]=='Q')
				w+=9;
				else if(c[j]=='q')
				b+=9;
				else  if(c[j]=='R')
					w+=5;
				else if(c[j]=='r')
					b+=5;

				else if(c[j]=='B')
					w+=3;
				else if(c[j]=='b')
					b+=3;

				else if(c[j]=='K')
					w+=3;
				else if(c[j]=='k'){
					b+=3;
				}
			}
		}
		if(b>w){
			System.out.println("Black");
		}else if(w>b){
			System.out.println("White");
		}else if(w==b){
			System.out.println("Draw");
		}
	}

}


import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 *
 * @author AL_DEEB
 */
public class AandBanChess {
     public static void main(String[] args) {
		StringBuilder sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);
		Scanner sc = new Scanner(bs);

                int white=0,black=0;
                for (int i = 0; i < 8; i++) {
                    String s=sc.next();
                    for (int j = 0; j < 8; j++) {
                       // if(s.charAt(j)=='.')continue;
                         if(s.charAt(j)=='Q')white+=9;
                         if(s.charAt(j)=='R')white+=5;
                         if(s.charAt(j)=='B')white+=4;
                         if(s.charAt(j)=='N')white+=3;
                         if(s.charAt(j)=='P')white+=1;
                         if(s.charAt(j)=='q')black+=9;
                         if(s.charAt(j)=='r')black+=5;
                         if(s.charAt(j)=='b')black+=4;
                         if(s.charAt(j)=='n')black+=3;
                         if(s.charAt(j)=='p')black+=1;
                    }

         }

                        if(white>black) System.out.println("White");
                    else if(white<black) System.out.println("Black");
                    else  System.out.println("Draw");
     }

}


import java.io.PrintWriter;
import java.util.Scanner;

public class prkkdf {

	public static void main(String[] args) {
		Scanner myscanner=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String[]s=new String[12];
		int result=0,sum=0;
		for(int i=0;i<8;i++){
			s[i]=myscanner.next();
			for(int j=0;j<s[i].length();j++){
				if(s[i].charAt(j)=='Q')
					result=result+9;
				else if(s[i].charAt(j)=='q')
					sum=sum+9;
				else if(s[i].charAt(j)=='R')
					result=result+5;
				else if(s[i].charAt(j)=='r')
					sum=sum+5;
				else if(s[i].charAt(j)=='K')
					result=result+3;
				else if(s[i].charAt(j)=='B')
					result=result+3;
				else if(s[i].charAt(j)=='P')
					result=result+1;
				else if(s[i].charAt(j)=='k')
					sum=sum+3;
				else if(s[i].charAt(j)=='b')
					sum=sum+3;
				else if(s[i].charAt(j)=='p')
					sum=sum+1;
				else
				{
					sum=sum+0;
					result=result+0;
				}

			}
		}
		if(result>sum)
			out.println("White");
		else if(result==sum)
			out.println("Draw");
		else
			out.println("Black");
		out.close();

	}

}


//package JustTasks;//package JustTasks;

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

public class App {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String one = in.nextLine();
        String two = in.nextLine();
        String three = in.nextLine();
        String four = in.nextLine();
        String five = in.nextLine();
        String six = in.nextLine();
        String seven = in.nextLine();
        String eight = in.nextLine();
        String work = one+two+three+four+five+six+seven+eight.replaceAll(".", "").replaceAll("K", "").replaceAll("k", "");
        int counterWhite = 0;
        int counterBlack = 0;
        while (work.contains("Q")){
            counterWhite=counterWhite+9;
            work.replaceFirst("Q","");
        }
        while (work.contains("R")){
            counterWhite=counterWhite+5;
            work.replaceFirst("R","");
        }
        while (work.contains("B")){
            counterWhite=counterWhite+3;
            work.replaceFirst("B","");
        }
        while (work.contains("N")){
            counterWhite=counterWhite+3;
            work.replaceFirst("N","");
        }
        while (work.contains("P")){
            counterWhite=counterWhite+1;
            work.replaceFirst("P","");
        }
        //black are bellow
        while (work.contains("q")){
            counterWhite=counterBlack+9;
            work.replaceFirst("q","");
        }
        while (work.contains("r")){
            counterWhite=counterBlack+5;
            work.replaceFirst("r","");
        }
        while (work.contains("b")){
            counterWhite=counterBlack+3;
            work.replaceFirst("b","");
        }
        while (work.contains("n")){
            counterWhite=counterBlack+3;
            work.replaceFirst("n","");
        }
        while (work.contains("p")){
            counterWhite=counterBlack+1;
            work.replaceFirst("p","");
        }
        if(counterWhite>counterBlack){
            System.out.println("White");
        }
        else if(counterBlack>counterWhite){
            System.out.println("Black");
        }
        else {
            System.out.println("Draw");
        }
    }
}


import java.util.Scanner;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Ura
 */
public class CF_91A {

    public static void main(String... args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();

        int[] luckyNambers = {4, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777};

        b:
        {
           for (int i = 0; i < luckyNambers.length; i++) {
            if (n % luckyNambers[i] == 0) {
                System.out.print("YES");
                break b;
            }

        }
        System.out.print("NO");
        }

    }
}


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

/**
 *
 * @author Athlon II
 */
public class division {

    public static void main(String p[]) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String inp = br.readLine();
        int in = Integer.parseInt(inp);

        if (in % 4 == 0 || in % 7 == 0) {
            System.out.println("YES");

        } else {
            char[] temp = inp.toCharArray();
            //System.out.println(inp);
            for (int a = 0; a < temp.length; a++) {
                //System.out.print(temp[a]);
                if (temp[a] != '4' && temp[a] != '7') {
                    System.out.println("NO");
                    return;
                }
            }
            System.out.println("YES");
        }

    }
}


import java.util.Scanner;

public class Beruntung
{
    public static void main(String[] args)
    {
        Scanner in = new Scanner(System.in);
        String masukan = in.next();
        boolean angkaBeruntung = false;

        int itung = 0;
        for(int i=0;i<masukan.length();i++)
        {
            char ch = masukan.charAt(i);
            if(ch=='4' || ch=='7') itung++;
        }
        if(itung == masukan.length()) angkaBeruntung = true;

        if(angkaBeruntung==false)
        {
            int input = Integer.parseInt(masukan);
            if(input%4==0 || input%7==0) angkaBeruntung = true;
        }

        if(angkaBeruntung == true) System.out.println("YES");
        else System.out.println("NO");
    }
}


/*
********QUESTION DESCRIPTION*************

* @author (codeKNIGHT)
 */
import java.util.*;
import java.math.*;
import java.io.*;
public class a91
{
    public static void main(String args[])throws IOException
    {
        Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        //FileReader f=new FileReader("C:\\users\\Lokesh\\Desktop\\input.txt");
            //Scanner in=new Scanner(f);
        //int t=in.nextInt();
        int i,c=0;
        String s;
        s=in.next();
        int n=Integer.parseInt(s);
        for(i=0;i<s.length();i++)
        {
            if(s.charAt(i)=='4'||s.charAt(i)=='7')
            c++;
        }
        if(c==s.length()||n%7==0||n%4==0)
        out.println("YES");
        else
        out.println("NO");

        out.flush();
    }
}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

 public class Solution  {

	static class FastScanner{
		BufferedReader s;
		StringTokenizer st;

		public FastScanner(){
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(File f) throws FileNotFoundException{
			st = new StringTokenizer("");
			s = new BufferedReader (new FileReader(f));
		}

		public int nextInt() throws IOException{
			if(st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());

			else{
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}

		public double nextDouble() throws IOException{
			if(st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else{
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}

		public long nextLong() throws IOException{
			if(st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else{
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}

		public String nextString() throws IOException{
			if(st.hasMoreTokens())
				return st.nextToken();
			else{
				st = new StringTokenizer(s.readLine());
				return nextString();
			}

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

		public void close() throws IOException{
			s.close();
		}

	}

	//FastScanner s = new FastScanner(new File("input.txt"));       copy inside void solve
    //PrintWriter ww = new PrintWriter(new FileWriter("output.txt"));
    static FastScanner s = new FastScanner();
    static PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String args[])throws IOException{
    	//Main ob=new Main();
    	Solution ob=new Solution();
		ob.solve();
		ww.close();
    }
    //////////////////////////////////////////////

    //////////////////////////////////////////////

    //////////////////////////////////////////////
    		 void solve() throws IOException {

    			long n = s.nextLong();
    			long x = s.nextInt();
    			int dis = 0;

    			for(int i=0;i<n;i++){
    				char ch = s.nextString().charAt(0);
    				long d = s.nextLong();
    				if(ch == '+')
    					x += d;
    				else{
    					if(x<d)
    						dis++;
    					else
    						x-=d;

    				}
    			}

    			ww.print(x+" "+dis);
    		 }//solve

}


package contest682;

import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		new A().solver();
	}

	void solver() {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int m = sc.nextInt();

		long ans = 0;
		ans += (n / 5) * (m / 5);
		ans += ((n + 4) / 5) * ((m + 1) / 5);
		ans += ((n + 3) / 5) * ((m + 2) / 5);
		ans += ((n + 2) / 5) * ((m + 3) / 5);
		ans += ((n + 1) / 5) * ((m + 4) / 5);

		System.out.println(ans);
	}
}


package codeforces.c358;

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

public class A {

	public static void main(String[] args) {
		try {
			InputStreamReader converter = new InputStreamReader(System.in);
			BufferedReader in = new BufferedReader(converter);
			String str = in.readLine();

			String[] data = str.split(" ");
			Integer col1 = Integer.parseInt(data[0]);
			Integer col2 = Integer.parseInt(data[1]);

			int temp = col1 * (col2 / 5) + (col1 / 5) * (col2 % 5);
			int left = col1;
			int right = col1 + col2;
			while (right / 5 - left / 5 > col2 / 5) {
				temp++;
				left--;
				right--;
			}
			System.out.println(temp);

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}


import java.util.Scanner;

public class CF358A {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt(), b = scan.nextInt();
		int n = Math.min(a, b), m = Math.max(a, b);
		long c = 0;
		if(n >=5 || m >= 5){
			for(int i = 1; i <= n; i++){
				int y = m;
				while((i+y)%5!=0)y--;
				c+=i%5==0?y/5:y/5+1;
			}
		}
		System.out.println(c);
	}

}


import java.util.*;
public class rota{
	static int flag=0;
	public static void main(String s[]){
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		ArrayList<Integer> al = new ArrayList<>();
		for(int i=0;i<n;i++)
			al.add(sc.nextInt());

		boolean b = check(al, 0, al.size(), 0);
		if(flag==1)
			System.out.println("YES");
		else System.out.println("NO");

	}
	public static boolean check(ArrayList<Integer> al , int count, int size, int sum){

		if(count == size ){
			if(sum==0 || sum==360){
			flag=1;
			}
			return true;
		}

		if(count >= size && sum!=0)
			return false;
		boolean b1=false;
		b1 = check(al, count+1, size, sum+al.get(count));
		b1 = check(al, count+1, size, sum-al.get(count));
		return b1;
	}
}


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

/* abhi2601 */

public class Q1 implements Runnable{

    final static long mod = (long)1e9 + 7;
    static boolean find (int arr[], int n, int sum)
    {
        if (sum == 0)
            return true;
        if (n == 0 && sum != 0)
            return false;
        if (arr[n-1] > sum)
            return find (arr, n-1, sum);
        return find (arr, n-1, sum) ||
                find (arr, n-1, sum-arr[n-1]);
    }
    public void run() {

        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n=sc.nextInt(),sum=0;
        int a[]=new int[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
            sum+=a[i];
        }
        if(sum%360==0) w.println("YES");
        else if(sum%2!=0) w.println("NO");
        else{
            boolean q=find(a,n,sum/2);
            if(q==true) w.println("YES");
            else w.println("NO");
        }
        w.close();
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private 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 String nextLine()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        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 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 double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            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)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

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

    public static void main(String args[]) throws Exception
    {
        new Thread(null, new Q1(),"q1",1<<26).start();
    }
}


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

/**
 * 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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
            }
            for (int i = 0; i < (1 << n); ++i) {
                int t = 0;
                for (int j = 0; j < n; ++i) {
                    if ((i & (1 << j)) == 1) {
                        t += a[j];
                        t %= 360;
                    } else {
                        t -= a[j];
                        t = (t + 360) % 360;
                    }
                }
                if (t == 0) {
                    out.println("YES");
                    return;
                }
            }
            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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


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

/**
 * 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;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
            }
            for (int i = 0; i < (1 << n); ++i) {
                int t = 0;
                for (int j = 0; j < n; ++i) {
                    if ((i & (1 << j)) == 1) t += a[j];
                    else t -= a[j];
                }
                if (t % 360 == 0) {
                    out.println("YES");
                    return;
                }
            }
            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 int nextInt() {
            return Integer.parseInt(next());
        }

    }
}