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

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);

    int a[] = new int[101];

    s = r.readLine();
    sl = s.split(" ");
    for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    }

    int v = 0;
    for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    }

    System.out.println(v);
  }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);

    int a[] = new int[101];

    s = r.readLine();
    sl = s.split(" ");
    for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    }

    int v = 0;
    for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    }

    System.out.println(v);
  }

} Main public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);

    int a[] = new int[101];

    s = r.readLine();
    sl = s.split(" ");
    for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    }

    int v = 0;
    for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    }

    System.out.println(v);
  } main {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);

    int a[] = new int[101];

    s = r.readLine();
    sl = s.split(" ");
    for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    }

    int v = 0;
    for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    }

    System.out.println(v);
  } BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1); r new BufferedReader(new InputStreamReader(System.in), 1) String s; s String sl[]; sl s = r.readLine() s r.readLine() r.readLine r sl = s.split(" ") sl s.split(" ") s.split s " " int n = Integer.parseInt(sl[0]); n Integer.parseInt(sl[0]) Integer.parseInt Integer sl[0] sl 0 int a[] = new int[101]; a new int[101] 101 s = r.readLine() s r.readLine() r.readLine r sl = s.split(" ") sl s.split(" ") s.split s " " for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
    	a[i + 1] = Integer.parseInt(sl[i]);
    } {
    	a[i + 1] = Integer.parseInt(sl[i]);
    } a[i + 1] = Integer.parseInt(sl[i]) a[i + 1] a i + 1 i 1 Integer.parseInt(sl[i]) Integer.parseInt Integer sl[i] sl i int v = 0; v 0 for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    } int i = 100; int i = 100; i 100 i > 0 i 0 i-- i-- i {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    } {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    } boolean b = false; b false for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        } int j = 0; int j = 0; j 0 j <= n j n j++ j++ j {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        } {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        } if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	} i <= a[j] && !b i <= a[j] i a[j] a j !b b {
        		v++;
        		b = true;
        	} v++ v b = true b true if(a[j] < i)
        	{
        		b = false;
        	} a[j] < i a[j] a j i {
        		b = false;
        	} b = false b false System.out.println(v) System.out.println System.out System System.out v String[] args args public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);

    int a[] = new int[101];

    s = r.readLine();
    sl = s.split(" ");
    for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    }

    int v = 0;
    for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    }

    System.out.println(v);
  }

} public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);

    int a[] = new int[101];

    s = r.readLine();
    sl = s.split(" ");
    for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    }

    int v = 0;
    for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    }

    System.out.println(v);
  }

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

public class Main
{
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s;
    String sl[];

    s = r.readLine();
    sl = s.split(" ");

    int n = Integer.parseInt(sl[0]);

    int a[] = new int[101];

    s = r.readLine();
    sl = s.split(" ");
    for(int i = 0; i < n; i++)
    {
    	a[i + 1] = Integer.parseInt(sl[i]);
    }

    int v = 0;
    for(int i = 100; i > 0; i--)
    {
    	boolean b = false;
        for(int j = 0; j <= n; j++)
        {
        	if(i <= a[j] && !b)
        	{
        		v++;
        		b = true;
        	}
        	else if(a[j] < i)
        	{
        		b = false;
        	}
        }
    }

    System.out.println(v);
  }

}