import Glibc
extension String: CollectionType {}

//var abc = readLine()!.split(" ").map { Int($0)! }
var a = readLine()!
var b = readLine()!
print(a == String(b.characters.reverse()) ? "YES" : "NO")


func i()->[String]{return readLine()!.characters.map{String($0)}};print(i()==i().reverse() ?"YES":"NO")


func i()->[String]{return readLine()!.characters.map{String($0)}};print(i()==i().reverse ?"YES":"NO")


print(readLine()!.characters.map{String($0)}==readLine()!.characters.map{String($0)}.reverse ?"YES":"NO")


print(readLine()!.characters.map{$0}==readLine()!.characters.map{$0}.reverse ?"YES":"NO")


"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let x = xs[0].split('');
   let y = xs[1].split('');
   let z = [];
   let count = 0;
   for(let i =y.length-1; i>=0; i--){
       z.push(y[i]);
   }
   for(let i=0; i<x.length; i++){
     if(x[i]==z[i]){
       count++
     }else{
       break;
     }
   }
   if(count==x.length){
     console.log('YES');
   }else{
     console.log('NO');
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


const main = (input) => {
  input = input.trim();
  input = input.split('\n');
  const A = input[0];
  const B = input[1];

  if (A[0]==B[2]&&A[2]==B[0]&&A[1]==B[1]){
    console.log("YES");
  }else{
    console.log("NO");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a:number[]=[];for(let i=0;i<arg;i++) {a.push(t.n());}return a;}else{const a = t.input[0];t.input.shift();return Number(a);}},s:(arg:number=0):any=>{if(arg){const a:string[]=[];for(let i=0;i<arg;i++){a.push(t.s());}return a;}else{const a=t.input[0];t.input.shift();return String(a);}},c:(arg:number=0):any=>{if(arg) {const a:string[]=[];for(let i=0;i<arg;i++) {a.push(t.c());}return a;}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('');}else{t.input.shift();}return String(b);}},o: (...arg)=>{console.log(...arg);},abs:(a)=>{return Math.abs(a);},min:(a)=>{return Math.min(a);},max:(a)=>{return Math.max(a);},floor:(a)=>{return Math.floor(a);},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b});},desc:(ar:number[])=>{ return ar.sort((a,b)=>{return b-a});},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1]}return arr[arr.length-1];}}
const main = ()=>{
  let [a,b,c,d,e,f] = t.c(6)
  t.o(a==f&&b==e&&c==d?'YES':'NO')
}
main()


import * as fs from 'fs';

namespace AtCoder {
    export interface Paramable {
        readonly args: string[][];
    }

    export interface Task {
        main(this: Task): void;
    }
}

namespace AtCoder.abc001 {
    export class TaskA implements AtCoder.Task, AtCoder.Paramable {
        public constructor(public readonly args: string[][]) {
        }

        public main(this: TaskA): void {
            const [c1, c2, c3]: string[] = this.args[0][0].split('');
            const [c4, c5, c6]: string[] = this.args[1][0].split('');

            if (c1 === c6 && c2 === c5 && c3 === c4) {
                console.log('Yes');
            } else {
                console.log('No');
            }

        }
    }

    const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(r => r.split(' '));
    const task: AtCoder.Task = new TaskA(args);
    task.main();
}


const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a:number[]=[];for(let i=0;i<arg;i++) {a.push(t.n());}return a;}else{const a = t.input[0];t.input.shift();return Number(a);}},s:(arg:number=0):any=>{if(arg){const a:string[]=[];for(let i=0;i<arg;i++){a.push(t.s());}return a;}else{const a=t.input[0];t.input.shift();return String(a);}},c:(arg:number=0):any=>{if(arg) {const a:string[]=[];for(let i=0;i<arg;i++) {a.push(t.c());}return a;}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('');}else{t.input.shift();}return String(b);}},o: (...arg)=>{console.log(...arg);},abs:(a)=>{return Math.abs(a);},min:(a)=>{return Math.min(a);},max:(a)=>{return Math.max(a);},floor:(a)=>{return Math.floor(a);},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b});},desc:(ar:number[])=>{ return ar.sort((a,b)=>{return b-a});},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1]}return arr[arr.length-1];}}
const main = ()=>{
  let [a,b,c,d,e,f] = t.c(6)
  t.o(a==f&&b==e&&c==d?'Yes':'No')
}
main()


const main = (input) => {
  input = input.trim();
  input = input.split('\n');
  const A = input[0];
  const B = input[1];

  const Aresult = A.slice(0,1);
  const resultA = A.slice(-1);
  const Bresult = B.slice(0,1);
  const resultB = B.slice(-1);
  const Acenter = A.slice(0,2);
  const Bcenter = B.slice(0,2);

  if (Aresult==resultB&&Bresult==resultA&&Acenter==Bcenter){
    console.log("YES");
  }else{
    console.log("NO");
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


l = sorted(list(map(int, input().split())), reverse = True)
print(l[0] * 10 + l[1] + l[2])


a,b,c=map(int,input().split())

print(max(a,b,c)*9+a+b+c)


val = sorted(map(int, input().split()))

print(max(val) * 9 + sum(val))


A, B, C = map(int, input().split())

t = sorted([A, B, C])
print(t[0] * 10 + t[1] + t[2])


A, B, C = map(int, input().split())

t = sorted([A, B, C])
print(A * 10 + B + C)


A, B, C = map(int, input().split())

print(max(A * 10 + B + C, A + B * 10 + C))


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

class Main{

	static void solve(){
		int a = ni(), b=ni(), c=ni();
		int d = Math.max(a, Math.max(b,c ));
		out.println(d*10 + (a+b+c-d));

	}

	 public static void main(String[] args){
		 solve();
		 out.flush();
	 }
	 private static InputStream in = System.in;
	 private static PrintWriter out = new PrintWriter(System.out);

	 static boolean inrange(int y, int x, int h, int w){
		 return y>=0 && y<h && x>=0 && x<w;
	 }
	 @SuppressWarnings("unchecked")
	 static<T extends Comparable> int lower_bound(List<T> list, T key){
		 int lower=-1;int upper=list.size();
		 while(upper - lower>1){
		 int center =(upper+lower)/2;
		 if(list.get(center).compareTo(key)>=0)upper=center;
		 else lower=center;
		 }
		 return upper;
	 }
	 @SuppressWarnings("unchecked")
	 static <T extends Comparable> int upper_bound(List<T> list, T key){
		 int lower=-1;int upper=list.size();
		 while(upper-lower >1){
		 int center=(upper+lower)/2;
		 if(list.get(center).compareTo(key)>0)upper=center;
		 else lower=center;
		 }
		 return upper;
	 }
	 @SuppressWarnings("unchecked")
	 static <T extends Comparable> boolean next_permutation(List<T> list){
		 int lastIndex = list.size()-2;
		 while(lastIndex>=0 && list.get(lastIndex).compareTo(list.get(lastIndex+1))>=0)--lastIndex;
		 if(lastIndex<0)return false;
		 int swapIndex = list.size()-1;
		 while(list.get(lastIndex).compareTo(list.get(swapIndex))>=0)swapIndex--;
		 T tmp = list.get(lastIndex);
		 list.set(lastIndex++, list.get(swapIndex));
		 list.set(swapIndex, tmp);
		 swapIndex = list.size()-1;
		 while(lastIndex<swapIndex){
		 tmp = list.get(lastIndex);
		 list.set(lastIndex, list.get(swapIndex));
		 list.set(swapIndex, tmp);
		 ++lastIndex;--swapIndex;
		 }
		 return true;
	 }
	 private static final byte[] buffer = new byte[1<<15];
	 private static int ptr = 0;
	 private static int buflen = 0;
	 private static boolean hasNextByte(){
		 if(ptr<buflen)return true;
		 ptr = 0;
		 try{
			 buflen = in.read(buffer);
		 } catch (IOException e){
			 e.printStackTrace();
		 }
		 return buflen>0;
	 }
	 private static int readByte(){ if(hasNextByte()) return buffer[ptr++]; else return -1;}
	 private static boolean isSpaceChar(int c){ return !(33<=c && c<=126);}
	 private static int skip(){int res; while((res=readByte())!=-1 && isSpaceChar(res)); return res;}

	 private static double nd(){ return Double.parseDouble(ns()); }
	 private static char nc(){ return (char)skip(); }
	 private static String ns(){
		 StringBuilder sb = new StringBuilder();
		 for(int b=skip();!isSpaceChar(b);b=readByte())sb.append((char)b);
		 return sb.toString();
	 }
	 private static int[] nia(int n){
		 int[] res = new int[n];
		 for(int i=0;i<n;++i)res[i]=ni();
		 return res;
	 }
	 private static long[] nla(int n){
		 long[] res = new long[n];
		 for(int i=0;i<n;++i)res[i]=nl();
		 return res;
	 }
	 private static int ni(){
		 int res=0,b;
		 boolean minus=false;
		 while((b=readByte())!=-1 && !((b>='0'&&b<='9') || b=='-'));
		 if(b=='-'){
			 minus=true;
			 b=readByte();
		 }
		 for(;'0'<=b&&b<='9';b=readByte())res=res*10+(b-'0');
		 return minus ? -res:res;
	 }
	 private static long nl(){
		 long res=0,b;
		 boolean minus=false;
		 while((b=readByte())!=-1 && !((b>='0'&&b<='9') || b=='-'));
		 if(b=='-'){
			 minus=true;
			 b=readByte();
		 }
		 for(;'0'<=b&&b<='9';b=readByte())res=res*10+(b-'0');
		 return minus ? -res:res;
	}
}


import java.util.HashSet;
import java.util.Set;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] xyz = br.readLine().split(" ");
        int x = Integer.parseInt(xyz[0]);
        int y = Integer.parseInt(xyz[1]);
        int z = Integer.parseInt(xyz[2]);

        int a = x*10+y+z;
        int b = x+y*10+z;
        int c = x+y+z*10;

        if (a>=b && a>=c) {
            System.out.println(a);
        }
        else if (b>=a && b >= c) {
            System.out.println(b);
        }
        else {
            System.out.println(c);
        }

        //System.out.println(Math.max(a, b, c));

    }
}


import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax
    static final int INF = 1_000_000_000; // 10^9
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n[] = new int[3];
		for(int i = 0;i<3;i++){
			n[i] = saori.saori_hayami();
		}
		Arrays.sort(n);
		int a = n[2] * 10 + n[1] + n[0];
		System.out.println(a);

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() {
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) {
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() {
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }

}


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

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int[] arr = fs.nextIntArray(3);
        Arrays.sort(arr);
        System.out.println(arr[0] * 10 + arr[1] + arr[2]);
    }

    static final class Utils {
        public static void shuffleSort(int[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffleSort(long[] x) {
            shuffle(x);
            Arrays.sort(x);
        }

        public static void shuffle(int[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void shuffle(long[] x) {
            final Random r = new Random();

            for (int i = 0; i <= x.length - 2; i++) {
                final int j = i + r.nextInt(x.length - i);
                swap(x, i, j);
            }
        }

        public static void swap(int[] x, int i, int j) {
            final int t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        public static void swap(long[] x, int i, int j) {
            final long t = x[i];
            x[i] = x[j];
            x[j] = t;
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

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


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

public class Main {
    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[] arr = {a,b,c};
        Arrays.sort(arr);

        System.out.println(((c*10)+b)+a);
    }
}


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

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int a = Integer.parseInt(in.next());
            int b = Integer.parseInt(in.next());
            int c = Integer.parseInt(in.next());
            int ans1 = a + b * 10 + c;
            int ans2 = a * 10 + b + c;

            // 出力
            out.println(Math.max(ans1, ans2));

        }

    }
}


#include<stdio.h>
int main()
{
    int a,b,c,max,hi;
    // 整数の入力
    scanf("%d %d %d", &a,&b,&c);

	if(a>=b && a>=c){
      max=10*a+b+c;
    }else if(b>=a && b>=c){
      max=a+10*b+c;
    }else{
      max=a+b+10*c;
    }
    // 出力
    printf("%d \n",max);
    return 0;
}


#include <stdio.h>

int main(){
    int a,b,c;
    int ans;
    scanf("%d %d %d",&a, &b, &c);
    if(a>=b && a>=c) ans = a*10+b+c;
    else if (b>=c && b>=a) ans=b*10+a+c;
    else ans=c*10+b+a;
    printf("%d\n",ans);
    return 0;
}


#include <stdio.h>

int max(int a,int b)
{
    return a>b?a:b;
}

int main()
{
    int a[3];
    scanf("%d %d %d",&a[0],&a[1],&a[2]);
    printf("%d\n",max(a[0],max(a[1],a[2]))*10+a[0]+a[1]+a[2]-max(a[0],max(a[1],a[2])));
}


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    cout << max(a*10+b + c, a+b*10+c) << endl;

    return (0);
}


#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    ans = max(ans, 10*a+b+c);
    ans = max(ans, a+b*10+c);
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL << 60;
#define PI 3.14159265359
long long MOD = 1000000007;

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}

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

long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}

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

long long dp[200100];

int main(){
    int a, b, c;
    cin >> a >> b >> c;

    cout << max(10*a + b, 10*b+c) << endl;

}


#include <stdio.h>

int main(void){

  int a,b,c;
	scanf("%d %d %d", &a, &b, &c);
	int max = a;
	if (b > max) {
		max = b;
	}
	if (c > max) {
		max = c;
	}
	int answer = a+b+c+max*9;
	printf("%d\n", answer);

  return 0;
}


i=3,x,s;main(b){for(;i--;s+=x,b=b>x?b:x)scanf("%d",&x);printf("%d\n",s+b*9);}


#include<stdio.h>
int main(void){
  int a,b,c;
  int d,e,f;
  scanf("%d %d %d", &a,&b,&c);
  if(a < b){
    if(b < c){
      d = c;
      e = b;
      f = a;
    }
    else{
      d = b;
      e = c;
      f = a;
    }
  }
  else{
    if(a < c){
      d = c;
      e = a;
      f = b;
    }
    else{
      d = a;
      e = c;
      f = b;
    }
  }
  printf("%d\n", (d*10)+e+f);
  return 0;
}


//   https://atcoder.jp/contests/abc110/tasks/abc110_a

#include<stdio.h>   //AA06( 30/ 07/ 20) If u see my code, Have a Good Day! (^_^)

int Maximum(int x, int y, int z);

int main()
{
    int A, B, C, Ans;

    (void)scanf("%d%d%d", &A, &B, &C);

    Ans = (Maximum(A, B, C) * 10 ) + A + B + C - Maximum(A, B, C);

    printf("%d\n", Ans);

    return 0;
}

int Maximum(int x, int y, int z)
{
    if(x > y && x > z)
        return x;

    else if(y > z && y > x)
        return y;

    else
        return z;
}


//   https://atcoder.jp/contests/abc110/tasks/abc110_a

#include<stdio.h>   //AA06( 29/ 07/ 20) If u see my code, Have a Good Day! (^_^)

int Maximum(int x, int y, int z);

int main(void)
{
    int A, B, C, Ans;

    scanf("%d%d%d", &A, &B, &C);

    Ans = (Maximum(A, B, C) * 10 ) + A + B + C - Maximum(A, B, C);

    printf("%d\n", Ans);

    return 0;
}

int Maximum(int x, int y, int z)
{
    if(x > y && x > z)
        return x;

    else if(y > z && y > x)
        return y;

    else
        return z;
}


//   https://atcoder.jp/contests/abc110/tasks/abc110_a

#include<stdio.h>   //AA06( 29/ 07/ 20) If u see my code, Have a Good Day! (^_^)

int Maximum(int x, int y, int z);

int main()
{
    int A, B, C, Ans;

    scanf("%d%d%d", &A, &B, &C);

    Ans = (Maximum(A, B, C) * 10 ) + A + B + C - Maximum(A, B, C);

    printf("%d\n", Ans);

    return 0;
}

int Maximum(int x, int y, int z)
{
    if(x > y && x > z)
        return x;

    else if(y > z && y > x)
        return y;

    else
        return z;
}


function Main(input) {
	input = input.trim().split(" ");
  input.sort(function(a,b){
  	return parseInt(b) - parseInt(a);
  });
  console.log(parseInt(input[0] + input[1]) + parseInt(input[2]));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(input) {
  const A = parseInt(input.split(" ")[0], 10);
  const B = parseInt(input.split(" ")[1], 10);
  const C = parseInt(input.split(" ")[2], 10);
  var arr=[A+10*B+C, 10*A+B+C, 10*C+A+B]
  console.log(Math.max.apply(null, arr));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);
	var c = parseInt(tmp[2], 10);

    var max = Math.max(a,b,c);

    if (a == max) {
        console.log('%d',((a * 10) + b + c));
        return;
    }
    if (b == max) {
        console.log('%d',((b * 10) + a + c));
        return;
    }
    if (c == max) {
        console.log('%d',((c * 10) + a + b));
        return;
    }

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function main(input) {
   input = input.trim();
  const a = input.split(" ").map(Number);
  console.log(Math.max(a[0],Math.max(a[1],a[2])*9+a[0]+a[1]+a[2]));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function main(input){
    abc=input.split(' ');
    abc=abc.sort();
    a='';
    a+=abc[2];
    a+=abc[1];
    a=parseInt(a,10);
    b=parseInt(abc[0],10);
    console.log(a+b);

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function main(input){
    abc=input.split(' ');
    abc=abc.sort()
    a=''
    a+=abc[2]
    a+=abc[1]
    a=parseInt(a,10)
    b=parseInt(abc[0],10)
    console.log(a+b)

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


package main

import (
	"fmt"
	"math"
)

// 以下の問題
// https://atcoder.jp/contests/abc110/tasks/abc110_a

func main() {
	var a, b, c float64
	fmt.Scan(&a, &b, &c)

	// A問題なのでsortを使わずにmath.Maxで解くのが正攻法だと思う
	fmt.Println(math.Max(10*a+b+c, math.Max(10*b+a+c, 10*c+a+b)))
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc.Split(bufio.ScanWords)
	a := nextInts(3)
	sort.Sort(sort.IntSlice(a))
	puts(a[2]*10 + a[1] + a[0])
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


package main

import (
	"fmt"
	"strconv"
)

func main() {
	var panels []int
	var a, b, c int
	_, err := fmt.Scanf("%d %d %d", &a, &b, &c)
	if err != nil {
		fmt.Println(err)
	}

	panels = append(panels, a)
	panels = append(panels, b)
	panels = append(panels, c)

	for i := 0; i < len(panels); i++ {
		max := i
		for j := i + 1; j < len(panels); j++ {
			if panels[max] < panels[j] {
				max = j
			}
		}
		if i != max {
			tmp := panels[max]
			panels[max] = panels[i]
			panels[i] = tmp
		}
	}

	d := strconv.Itoa(panels[0])
	e := strconv.Itoa(panels[1])
	f, _ := strconv.Atoi(d + e)
	sum := f + panels[2]
	fmt.Println(sum)
}


package main

import (
	"fmt"
	"strconv"
)

func main() {
	var panels []int
	var a, b, c int
	_, err := fmt.Scanf("%d %d %d", &a, &b, &c)
	if err != nil {
		fmt.Println(err)
	}

	panels = append(panels, a)
	panels = append(panels, b)
	panels = append(panels, c)

	for i := 0; i < len(panels); i++ {
		max := i
		for j := i + 1; j < len(panels); j++ {
			if panels[max] < panels[j] {
				max = j
			}
		}
		if i != max {
			tmp := panels[max]
			panels[max] = panels[i]
			panels[i] = tmp
		}
	}

	d := strconv.Itoa(panels[0])
	e := strconv.Itoa(panels[1])
	f, _ := strconv.Atoi(d + e)
	sum := f + panels[2]
	fmt.Println(sum)


package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func run() {
	n := nextInt()
	k := nextInt()
	s := nextInt()

	if (n >= k || n >= s) {
		Println(n*10 + k+s)
	}else if(k >= s || k >= n ){
		Println(k *10 + k+s)
	}else {
		Println(s* 10 + k+n)
	}

}

// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024

func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}

func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}

func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}


package main

func main(){
	var A,B,C int
	fmt.Scan(&A,&B,&C)
	if A >= B && A >= C{
		fmt.Println(10*A + B + C)
	}else if B >= A && B >= C{
		fmt.Println(10*B + A + C)
	}else{
		fmt.Println(10*C + A + B)
	}

}


s = gets.to_s.split.map{|t|t.to_i}.sort.reverse
ans = s[0] * 10 + s[1] + s[2]
puts ans


a=gets.split.map(&:to_i).sort
b=("#{a[2]}" + "#{a[1]}")
p b.to_i + a[0]


ls = (gets.chomp.split.map(&:to_i)).sort().reverse()
puts ls[0] * 10 + ls[1] + ls[2]


a=gets.chomp
b=gets.chomp
puts a==b.tr(a.tr(a,b),a)?:Yes: :No


a, b, c = gets.split.map(&:to_i)
x = a * 10 + b + c
y = a + b * 10 + c

puts [x,y].max


a, b, c = gets.chomp.split.map(&:to_i)
puts [10 * a + b + c, 10 * b + a + c].max


use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::max;

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    let x = a * 10 + b + c;
    let y = a + b * 10 + c;
    let z = a + b + c * 10;
    println!("{}", max(x, max(y, z)));
}


macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: u32,
        b: u32,
        c: u32,
    }
    let mut v = vec![a,b,c];
    v.sort();
    println!("{}", v[2] * 10 + v[1] + v[0]);
}


use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter:Vec<&str> = buf.split_whitespace().collect();
	let mut s:Vec<String> = Vec::new();
	for i in 0..3 {
		s.push(iter[i].to_string());
	}
	s.sort();
	let x = s[2].parse::<i32>().ok().unwrap() * 10 + s[1].parse::<i32>().ok().unwrap();
	let y = s[0].parse::<i32>().ok().unwrap();
	println!("{}", x+y);
}


//! https://github.com/hatoo/competitive-rust-snippets
//!
//! MIT License
//!
//! Copyright (c) 2018 hatoo
//!
//! Permission is hereby granted, free of charge, to any person obtaining a copy
//! of this software and associated documentation files (the "Software"), to deal
//! in the Software without restriction, including without limitation the rights
//! to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//! copies of the Software, and to permit persons to whom the Software is
//! furnished to do so, subject to the following conditions:
//!
//! The above copyright notice and this permission notice shall be included in all
//! copies or substantial portions of the Software.
//!
//! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//! SOFTWARE.
#![allow(
    unused_imports,
    unused_attributes,
    unused_macros,
    dead_code,
    non_snake_case
)]
use std::cmp::{max, min, Ordering};
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{stdin, stdout, BufWriter, Write};
use std::iter::FromIterator;
#[macro_export]
macro_rules ! get {(@ inner [$ src : expr ] chars ) => {{let mut buf = String :: new () ; $ src . read_line (& mut buf ) . unwrap () ; buf . trim () . chars () . collect ::< Vec < char >> () } } ; (@ inner [$ src : expr ] usize1 ) => {{get ! (@ inner [$ src ] usize ) - 1 } } ; (@ inner [$ src : expr ] [usize1 ] ) => {{get ! (@ inner [$ src ] [usize ] ) . into_iter () . map (| v | v - 1 ) . collect ::< Vec < usize >> () } } ; (@ inner [$ src : expr ] [[usize1 ] ; $ n : expr ] ) => {{(0 ..$ n ) . map (| _ | get ! (@ inner [$ src ] [usize1 ] ) ) . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] [usize1 ; $ n : expr ] ) => {{(0 ..$ n ) . map (| _ | get ! (@ inner [$ src ] [usize1 ] ) ) . flatten () . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] [[chars ] ; $ n : expr ] ) => {{(0 ..$ n ) . map (| _ | get ! (@ inner [$ src ] chars ) ) . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] [chars ; $ n : expr ] ) => {{(0 ..$ n ) . map (| _ | get ! (@ inner [$ src ] chars ) ) . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] [($ ($ tt : tt ) ,* ) ; $ n : expr ] ) => {{(0 ..$ n ) . map (| _ | get ! (@ inner [$ src ] ($ ($ tt ) ,* ) ) ) . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] ($ ($ tt : tt ) ,* ) ) => {{let mut buf : String = String :: new () ; $ src . read_line (& mut buf ) . unwrap () ; let mut iter = buf . split_whitespace () ; ($ (get ! (@ inner_elem_parse [$ tt ] iter . next () . unwrap () ) , ) * ) } } ; (@ inner [$ src : expr ] [$ t : ty ] ) => {{let mut buf = String :: new () ; $ src . read_line (& mut buf ) . unwrap () ; buf . trim () . split_whitespace () . map (| t | t . parse ::<$ t > () . unwrap () ) . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] [[$ t : ty ] ; $ n : expr ] ) => {{(0 ..$ n ) . map (| _ | get ! (@ inner [$ src ] [$ t ] ) ) . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] [$ t : ty ; $ n : expr ] ) => {{(0 ..$ n ) . map (| _ | get ! (@ inner [$ src ] [$ t ] ) ) . flatten () . collect ::< Vec < _ >> () } } ; (@ inner [$ src : expr ] $ t : ty ) => {{let mut buf = String :: new () ; $ src . read_line (& mut buf ) . unwrap () ; buf . trim () . split_whitespace () . next () . unwrap () . parse ::<$ t > () . unwrap () } } ; (@ inner_elem_parse [usize1 ] $ elem : expr ) => {{get ! (@ inner_elem_parse [usize ] $ elem ) - 1 } } ; (@ inner_elem_parse [$ t : ty ] $ elem : expr ) => {{$ elem . parse ::<$ t > () . unwrap () } } ; ($ tt : tt ) => {{use std :: io :: BufRead ; let get_stdin = std :: io :: stdin () ; let mut locked_stdin = get_stdin . lock () ; get ! (@ inner [& mut locked_stdin ] $ tt ) } } ; }
macro_rules ! debug {($ ($ a : expr ) ,* $ (, ) * ) => {# [cfg (debug_assertions ) ] eprintln ! (concat ! ($ ("| " , stringify ! ($ a ) , "={:?} " ) ,*, "|" ) , $ (&$ a ) ,* ) ; } ; }
macro_rules ! echo {($ ($ a : expr ) ,* ) => {let mut s = Vec :: new () ; $ (s . push (format ! ("{}" , $ a ) ) ; ) * println ! ("{}" , s . join (" " ) ) ; } }
#[macro_export]
macro_rules ! chmin {($ base : expr , $ ($ cmps : expr ) ,+ $ (, ) * ) => {{let cmp_min = min ! ($ ($ cmps ) ,+ ) ; if $ base > cmp_min {$ base = cmp_min ; true } else {false } } } ; }
#[macro_export]
macro_rules ! chmax {($ base : expr , $ ($ cmps : expr ) ,+ $ (, ) * ) => {{let cmp_max = max ! ($ ($ cmps ) ,+ ) ; if $ base < cmp_max {$ base = cmp_max ; true } else {false } } } ; }
#[macro_export]
macro_rules ! min {($ a : expr $ (, ) * ) => {{$ a } } ; ($ a : expr , $ b : expr $ (, ) * ) => {{std :: cmp :: min ($ a , $ b ) } } ; ($ a : expr , $ ($ rest : expr ) ,+ $ (, ) * ) => {{std :: cmp :: min ($ a , min ! ($ ($ rest ) ,+ ) ) } } ; }
#[macro_export]
macro_rules ! max {($ a : expr $ (, ) * ) => {{$ a } } ; ($ a : expr , $ b : expr $ (, ) * ) => {{std :: cmp :: max ($ a , $ b ) } } ; ($ a : expr , $ ($ rest : expr ) ,+ $ (, ) * ) => {{std :: cmp :: max ($ a , max ! ($ ($ rest ) ,+ ) ) } } ; }
const BIG_STACK_SIZE: bool = true;
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (a, b, c) = get!((i32, i32, i32));
    let mut ans = 0;
    chmax!(ans, a + 10 * b + c, 10 * a + b + c); // a, b, c
    chmax!(ans, a + 10 * c + b, 10 * a + c + c); // a, c, b
    chmax!(ans, b + 10 * a + c, 10 * b + a + c); // b, a, c
    chmax!(ans, b + 10 * c + a, 10 * b + c + a); // b, c, a
    chmax!(ans, c + 10 * a + b, 10 * c + a + b); // c, a, b
    chmax!(ans, c + 10 * b + a, 10 * c + b + a); // c, b, a
    echo!(ans);
}


use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::max;

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    let x = a * 10 + b + c;
    let y = a + b * 10 + c;
    let z = a + b + c * 10;
    println!("{}", max(a, max(b, c)));
}


use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    let x = a * 10 + b + c;
    let y = a + b * 10 + c;
    println!("{}", if x > y { x } else { y })
}


let input = readLine()!.characters.split(" ").map{Int(String($0))!}.sort(>)
print(input[0]*10 + input[1] + input[2])


func main() {
  let abc = readLine()!.split(separator: " ").map{Int($0)!}
  let result = abc.max()! * 10 + abc.reduce(0, +) - abc.max()!
  print(result)
}

main()


let input = readLine()!.characters.split(" ").map{Int(String($0))}.sort(>)
print(input[0]*10 + input[1] + input[2])


let input = readLine()!.characters.split(" ").map{Int($0)}.sort(>)
print(input[0]*10 + input[1] + input[2])


let input = readLine.characters.split(" ").map{Int($0)}.sort(>)
print(input[0]*10 + input[1] + input[2])


import * as fs from 'fs';

namespace AtCoder.abc110 {

    class Program {
        /**
         * in
         *  1 5 2
         * out
         *  53
         */
        main(inp: string): void {
            const abc: number[] = inp.split(' ').map(Number);
            const abcSorted:number[] = abc.sort((a, b) => b - a);

            const x: string = abcSorted.slice(0, 2).join('');
            const y: string = abcSorted.slice(2).join('');

            console.log(parseInt(x) + parseInt(y));
        }
    }

    const prg = new Program();
    prg.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
}


	const process = (a: string[]): number => {
		const aa = a.map((e) => parseInt(e))
		if (aa[0] >= aa[1] && aa[0] >= aa[2]) {
			return aa[0] * 10 + aa[1] + aa[2]
		}
		if (aa[1] >= aa[0] && aa[1] >= aa[2]) {
			return aa[0] + aa[1] * 10 + aa[2]
		}
		if (aa[2] >= aa[0] && aa[2] >= aa[1]) {
			return aa[0] + aa[1] + aa[2] * 10
		}
	}

	const Main = (input: string): void => {
		//const n: number = parseInt(input)
		const a: string[]  = input.split(" ")
		//const aa: string[][]  = input.split("\n").split(" ")
		const answer = process(a)
		console.log(answer)
	}

	/*
	// デバッグ用
	Main("1 5 2") // 53
	console.log()

	Main("9 9 9") // 108
	console.log()

	Main("6 6 7") // 82
	*/

	// 提出時はこちらをアクティブにする
	Main(require("fs").readFileSync("/dev/stdin", "utf8"))
}


var int = x=>parseInt(x,10);var spln = x=>x.split(/\n/g);var spsp = x=>x.split(/\s/g);
function main(input) {
  var a = input.split(/\n|\s/g).map((v)=>parseInt(v,10)).slice(0,3).sort()
  console.log(a[2]*10+a[1]+a[0])
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


{
	const process = (a: string[]): number => {
		const aa = a.map((e) => parseInt(e))
		// aa[0] が最大
		if (aa[0] >= aa[1] && aa[1] >= aa[2]) {
			return aa[0] * 10 + aa[1] + aa[2]
		}
		if (aa[1] >= aa[0] && aa[1] >= aa[2]) {
			return aa[0] + aa[1] * 10 + aa[2]
		}
		if (aa[2] >= aa[0] && aa[1] >= aa[1]) {
			return aa[0] + aa[1] + aa[2] * 10
		}
	}

	const Main = (input: string): void => {
		//const n: number = parseInt(input)
		const a: string[]  = input.split(" ")
		//const aa: string[][]  = input.split("\n").split(" ")
		const answer = process(a)
		console.log(answer)
	}

	/*
	// デバッグ用
	Main("1 5 2") // 53
	console.log()

	Main("9 9 9") // 108
	console.log()

	Main("6 6 7") // 82
	*/

	// 提出時はこちらをアクティブにする
	Main(require("fs").readFileSync("/dev/stdin", "utf8"))
}


import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    h_ls = tuple(map(int, input().split()))
    h_ = h_ls[-1]

    for h in h_ls[-2::-1]:
        if h > h_:
            if h - 1 == h_:
                continue
            print('No')
            quit()
        h_ = h
    print('Yes')

if __name__ == '__main__':
    main()


def main():
    H = map(int, open(0).read().split()[:0:-1])
    pre = None
    for h in H:
        if pre is None:
            pre = h
        elif h <= pre:
            pre = h
        elif pre + 1 == h:
            continue
        else:
            # pre + 1 < h
            print("No")
            return

    print("Yes")
    return

main()


def main():
    H = map(int, open(0).read().split()[:1:-1])
    pre = None
    for h in H:
        if pre is None:
            pre = h
        elif h <= pre:
            pre = h
        elif pre + 1 == h:
            continue
        else:
            # pre + 1 < h
            print("No")
            return

    print("Yes")
    return

main()


from collections import Counter
import math
import statistics
import itertools
# a,b=map(int,input().split())
b=int(input())
# c=[]
# for i in a:
#     c.append(int(i))
# A,B,C= map(int,input().split())
# f = list(map(int,input().split()))
#g = [list(map(lambda x: '{}'.format(x), list(input()))) for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen
# lis=[input() for i in range(a)]

lis = list(map(int,input().split()))
ans=lis[0]
seigi=lis
word=""
for i in range(1,b):
    word=lis[i]
    if ans<=word:
        ans=word
        word=""
    else:
        if ans-1 == word :
            ans=word
            seigi[i-1]-=1
            word=""

for i in range(b-1):
    if seigi[i] > seigi[i+1]:
        print("No")
        exit()

print("Yes")


from collections import Counter
import math
import statistics
import itertools
# a,b=map(int,input().split())
b=int(input())
# c=[]
# for i in a:
#     c.append(int(i))
# A,B,C= map(int,input().split())
# f = list(map(int,input().split()))
#g = [list(map(lambda x: '{}'.format(x), list(input()))) for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen
# lis=[input() for i in range(a)]

lis = list(map(int,input().split()))
ans=lis[0]
seigi=lis
word=""
for i in range(1,b):
    word=lis[i]
    if ans<=word:
        ans=word
        word=""
    else:
        if ans-1 == word :
            ans=word
            seigi[i-1]-=1
            word=""
seigi2=sorted(seigi)
if seigi2==seigi:
    print("Yes")
else:
    print("No")


n = int(input())
h = list(map(int, input().split()))

if n == 1:
    print("Yes")
elif n == 2:
    if h[0] - h[1] <= 1:
        print("Yes")
    else:
        print("No")
else:
    c = 0
    if h[0] - h[1] == 1:
        h[0] -= 1
        for i in range(1, n-1):
            if h[i] - h[i+1] == 1 and h[i-1] != h[i]:
                h[i] -= 1
                c += 1
            elif h[i] <= h[i+1]:
                c += 1
            else:
                break
    elif h[0] <= h[1]:
        for i in range(1, n-1):
            if h[i] - h[i+1] == 1 and h[i-1] != h[i]:
                h[i] -= 1
                c += 1
            elif h[i] <= h[i+1]:
                c += 1
            else:
                break

    if c == n-2:
        print("Yes")
    else:
        print("No")


import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

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

	void solve() {
		int n = ni();
		int[] a = na(n);
		if(n == 1) {
			out.println("Yes");
			return;
		}
		for(int i = n-2; i >= 0; i--) {
			if(a[i] <= a[i+1]) continue;
			a[i]--;
			if(a[i] > a[i+1]) {
				out.println("No");
				return;
			}
		}
		out.println("Yes");
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

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

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

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

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private float nf() {
		return Float.parseFloat(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

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

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}