using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Globalization;

namespace Beresta
{

	class ContestIO : StreamWriter
	{
		public ContestIO(Stream streamIn, Stream streamOut) : base(streamOut, Encoding.ASCII, 8192) { Reader = new StreamReader(streamIn, Encoding.ASCII, false, 8192); }
		public ContestIO(string inputFilePath, string outputFilePath) : this(File.OpenRead(inputFilePath), File.OpenWrite(outputFilePath)) { }
		public ContestIO() : this(Console.OpenStandardInput(8192), Console.OpenStandardOutput(8192)) { }
		//d.ToString("N12", CultureInfo.InvariantCulture).Replace(",", "")
		public StreamReader Reader;

		bool IsDigit(int c) { return c >= '0' && c <= '9'; }
		public long Read()
		{
			int c1 = 0, c;
			while (!IsDigit(c = Reader.Read())) { c1 = c; }
			long r = c - '0';
			while (IsDigit(c = Reader.Read()))
				r = r * 10 + c - '0';
			return c1 == '-' ? -r : r;
		}
		public long[] ReadArray(int size) { return Enumerable.Range(0, size).Select(v => Read()).ToArray(); }
	}

	class Program
	{

		static void Main(string[] args)
		{
			using (var io = new ContestIO())
			{
				var n = io.Read();
				var arr = io.ReadArray((int)n);

				Array.Sort(arr);
				for (var i = arr.Length - 1; i >= 0; i--)
				{
					if (arr[i] == 0)
						break;
					for (var j = i - 1; j >= 0; j--)
					{
						if (arr[j] == arr[i])
							arr[j]--;
						else
							break;
					}
				}

				var sum = arr.Sum();
				io.WriteLine(sum);
			}

			Console.ReadLine();
		}

	}

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF226
{
    class Program
    {
        static void Main(string[] args)
        {
            byte n, c;
            int res, eq, qe;
            string[] num = Console.ReadLine().Split(' ');
            n = byte.Parse(num[0]);
            c = byte.Parse(num[1]);

            string[] arr = Console.ReadLine().Split(' ');

            qe = 0;
            for (byte i = 0; i < n; i++)
            {
                if (i < (n - 1))
                {
                    if (int.Parse(arr[i]) > int.Parse(arr[i + 1]))
                    {
                        res = (int.Parse(arr[i]) - int.Parse(arr[i + 1]));
                        eq = res - c;
                        if (eq > 0 && eq>qe) qe = eq;
                    }
                }
            }
            Console.Write(qe);
        }
    }
}


#define Online
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.IO;

delegate double F (double x);

delegate decimal Fdec (decimal x);

partial class Program
{
	public static StreamReader sr;
	public static StreamWriter sw;

	static void Main (string[] args)
	{

#if FileIO
		sr = new StreamReader ("input.txt");
		sw = new StreamWriter ("output.txt");
		Console.SetIn (sr);
		Console.SetOut (sw);
#endif

		A ();

#if Online
		Console.ReadLine ();
#endif

#if FileIO
		sr.Close ();
		sw.Close ();
#endif

	}

	static void A ()
	{
		int n = NextInt ();
		int c = NextInt ();
		int[] x = new int[n];
		for (int i =0; i<n; i++)
			x [i] = NextInt ();
		int max = 0;
		for (int i =0; i<n-1; i++) {
			int cur = x [i] - x [i + 1] - c;
			max = Math.Max (max, cur);
		}
		Console.WriteLine (max);
	}

	static void B ()
	{

	}

	static void C ()
	{

	}

	static void D ()
	{

	}

	static void E ()
	{

	}

	static void TestGen ()
	{
		int n = 2000;

		StreamWriter sw = new StreamWriter ("input.txt");
		sw.WriteLine ("{0}", n);
		int x = 0;
		int y = 0;
		for (; x<500; x++) {
			sw.WriteLine ("{0} {1}", x, y);
		}
		for (; y<500; y++) {
			sw.WriteLine ("{0} {1}", x, y);
		}
		for (; x>0; x--) {
			sw.WriteLine ("{0} {1}", x, y);
		}
		for (; y>0; y--) {
			sw.WriteLine ("{0} {1}", x, y);
		}
		sw.Close ();
	}

}

public static class MyMath
{
	public static long BinPow (long a, long n, long mod)
	{
		long res = 1;
		while (n > 0) {
			if ((n & 1) == 1) {
				res = (res * a) % mod;
			}
			a = (a * a) % mod;
			n >>= 1;
		}
		return res;
	}

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

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

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

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

static class ArrayUtils
{
	static void Swap<T> (T[] a, int l, int r)
	{
		T t = a [l];
		a [l] = a [r];
		a [r] = t;
	}

	public static bool NextPermutation (int[] a)
	{
		bool isOkay = false;
		int n = a.Length;
		for (int i=n-2; i>=0; i--) {
			if (a [i] < a [i + 1]) {
				isOkay = true;
				int j = i + 1;
				while (j+1<n && a[j+1]>a[i]) {
					j++;
				}
				Swap (a, i, j);
				for (j=1; i+j<n-j; j++) {
					Swap (a, i + j, n - j);
				}
				break;
			}
		}
		return isOkay;
	}

	public static int BinarySearch (int[] a, int val)
	{
		int left = 0;
		int right = a.Length - 1;
		int mid;

		while (left < right) {
			mid = left + ((right - left) >> 1);
			if (val <= a [mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}

		if (a [left] == val)
			return left;
		else
			return -1;
	}

	public static double Bisection (F f, double left, double right, double eps)
	{
		double mid;
		while (right - left > eps) {
			mid = left + ((right - left) / 2d);
			if (Math.Sign (f (mid)) != Math.Sign (f (left)))
				right = mid;
			else
				left = mid;
		}
		return (left + right) / 2d;
	}

	public static decimal TernarySearchDec (Fdec f, decimal eps, decimal l, decimal r, bool isMax)
	{
		decimal m1, m2;
		while (r - l > eps) {
			m1 = l + (r - l) / 3m;
			m2 = r - (r - l) / 3m;
			if (f (m1) < f (m2))
			if (isMax)
				l = m1;
			else
				r = m2;
			else
                    if (isMax)
				r = m2;
			else
				l = m1;
		}
		return r;
	}

	public static double TernarySearch (F f, double eps, double l, double r, bool isMax)
	{
		double m1, m2;
		while (r - l > eps) {
			m1 = l + (r - l) / 3d;
			m2 = r - (r - l) / 3d;
			if (f (m1) < f (m2))
			if (isMax)
				l = m1;
			else
				r = m2;
			else
                    if (isMax)
				r = m2;
			else
				l = m1;
		}
		return r;
	}

	public static void Merge_Sort<T> (T[]A, int p, int r, Comparison<T> comp)
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		Merge_Sort (A, p, r, L, R, comp);
	}

	public static void Merge<T> (T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
	{
		for (int i = p; i <= q; i++)
			L [i] = A [i];
		for (int i = q + 1; i <= r; i++)
			R [i] = A [i];

		for (int k = p, i = p, j = q + 1; k <= r; k++) {
			if (i > q) {
				for (; k <= r; k++, j++)
					A [k] = R [j];
				return;
			}
			if (j > r) {
				for (; k <= r; k++, i++)
					A [k] = L [i];
				return;
			}
			if (comp (L [i], R [j]) <= 0) {
				A [k] = L [i];
				i++;
			} else {
				A [k] = R [j];
				j++;
			}
		}
	}

	private static void Merge_Sort<T> (T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
	{
		if (p >= r)
			return;
		int q = p + ((r - p) >> 1);
		Merge_Sort (A, p, q, L, R, comp);
		Merge_Sort (A, q + 1, r, L, R, comp);
		Merge (A, p, q, r, L, R, comp);
	}

	public static void Merge_Sort<T> (T[]A, int p, int r)where T:IComparable<T>
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		Merge_Sort (A, p, r, L, R);
	}

	public static void Merge<T> (T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
	{
		for (int i = p; i <= q; i++)
			L [i] = A [i];
		for (int i = q + 1; i <= r; i++)
			R [i] = A [i];

		for (int k = p, i = p, j = q + 1; k <= r; k++) {
			if (i > q) {
				for (; k <= r; k++, j++)
					A [k] = R [j];
				return;
			}
			if (j > r) {
				for (; k <= r; k++, i++)
					A [k] = L [i];
				return;
			}
			if (L [i].CompareTo (R [j]) <= 0) {
				A [k] = L [i];
				i++;
			} else {
				A [k] = R [j];
				j++;
			}
		}
	}

	private static void Merge_Sort<T> (T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
	{
		if (p >= r)
			return;
		int q = p + ((r - p) >> 1);
		Merge_Sort (A, p, q, L, R);
		Merge_Sort (A, q + 1, r, L, R);
		Merge (A, p, q, r, L, R);
	}

	public static void Merge_Sort_Non_Recursive<T> (T[] A, int p, int r) where T : IComparable<T>
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		int k = 1;
		while (k < r - p + 1) {
			int i = 0;
			while (i < r) {
				int _r = Math.Min (i + 2 * k - 1, r);
				int q = Math.Min (i + k - 1, r);
				Merge (A, i, q, _r, L, R);
				i += 2 * k;
			}
			k <<= 1;
		}
	}

	public static void Merge_Sort_Non_Recursive<T> (T[] A, int p, int r, Comparison<T> comp)
	{
		T[] L = new T[A.Length];
		T[] R = new T[A.Length];
		int k = 1;
		while (k < r - p + 1) {
			int i = 0;
			while (i < r) {
				int _r = Math.Min (i + 2 * k - 1, r);
				int q = Math.Min (i + k - 1, r);
				Merge (A, i, q, _r, L, R, comp);
				i += 2 * k;
			}
			k <<= 1;
		}
	}

	public static void Shake<T> (T[] a)
	{
		Random rnd = new Random (Environment.TickCount);
		int b;
		for (int i = 0; i < a.Length; i++) {
			b = rnd.Next (i, a.Length);
			Swap (a, i, b);
		}
	}
}

partial class Program
{
	static string[] tokens = new string[0];
	static int cur_token = 0;

	static void ReadArray (char sep)
	{
		cur_token = 0;
		tokens = Console.ReadLine ().Split (sep);
	}

	static int ReadInt ()
	{
		return int.Parse (Console.ReadLine ());
	}

	static long ReadLong ()
	{
		return long.Parse (Console.ReadLine ());
	}

	static int NextInt ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return int.Parse (tokens [cur_token++]);
	}

	static long NextLong ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return long.Parse (tokens [cur_token++]);
	}

	static double NextDouble ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return double.Parse (tokens [cur_token++]);
	}

	static decimal NextDecimal ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return decimal.Parse (tokens [cur_token++]);
	}

	static string NextToken ()
	{
		if (cur_token == tokens.Length)
			ReadArray (' ');
		return tokens [cur_token++];
	}

	static string ReadLine ()
	{
		return Console.ReadLine ();
	}
}


using System;
namespace SolutionsForCodeforces
{
    class RSP
    {
        static void Main(string[] args)
        {
            var F = Console.ReadLine();
            var M = Console.ReadLine();
            var S = Console.ReadLine();
            if ((F != M && F != S && M != S) || (F == M && F == S && M == S))
            {
                Console.WriteLine("?");
                return;
            }
            if (F == M)
            {
                if (WhoIsBetter(F, S))
                {
                    Console.WriteLine("?");
                    return;
                }
                else
                {
                    Console.WriteLine("S");
                    return;
                }
            }
            if (M == S)
            {
                if (WhoIsBetter(M, F))
                {
                    Console.WriteLine("?");
                    return;
                }
                else
                {
                    Console.WriteLine("F");
                    return;
                }
            }
            if (F == S)
            {
                if (WhoIsBetter(F, M))
                {
                    Console.WriteLine("?");
                    return;
                }
                else
                {
                    Console.WriteLine("M");
                    return;
                }
            }
        }
        static bool WhoIsBetter(string First, string Second)
        {
            if (First == "rock" && Second == "scissors") return true;
            if (First == "scissors" && Second == "paper") return true;
            if (First == "paper" && Second == "rock") return true;
            return false;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgrammingContest.Codeforces.Round45
{
    class A
    {
        public static void Main()
        {
            Dictionary<string, int> map = new Dictionary<string, int>();
            map["rock"] = 0;
            map["scissors"] = 1;
            map["paper"] = 2;
            int[] xs =new int[]{map[Console.ReadLine()],
                map[Console.ReadLine()],
                map[Console.ReadLine()]};
            for(int i = 0; i < 3; i++)
                for (int j = 1; j < 3; j++)
                {
                    int k = (i+j)%3;
                    if ((xs[i] + 1) % 3 == xs[k] && (xs[i] + 1) % 3 == xs[(k + 1) % 3])
                    {
                        Console.Write("FMS"[i]);
                        return;
                    }
                }
            Console.Write("?");
        }
    }
}


using System;
using System.Linq;
using System.Text;
using System.Collections.Generic;

class Program {
	static void Main() {
		string[] name = new string[]{"Washington", "Adams", "Jefferson", "Madison", "Monroe", "Adams", "Jackson", "Van Buren", "Harrison", "Tyler", "Polk", "Taylor", "Fillmore", "Pierce", "Buchanan", "Lincoln", "Johnson", "Grant", "Hayes", "Garfield", "Arthur", "Cleveland", "Harrison", "Cleveland", "McKinley", "Roosevelt", "Taft", "Wilson", "Harding", "Coolidge", "Hoover", "Roosevelt", "Truman", "Eisenhower", "Kennedy", "Johnson", "Nixon", "Ford", "Carter", "Reagan"};
		int i = int.Parse(Console.ReadLine());
		Console.WriteLine(name[i - 1]);
	}
}


using System;
using System.Collections.Generic;
using System.Linq;

namespace AprilFools2013A
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(@"Washington
Adams
Jefferson
Madison
Monroe
Adams
Jackson
Van Buren
Harrison
Tyler
Polk
Taylor
Fillmore
Pierce
Buchanan
Lincoln
Johnson
Grant
Hayes
Garfield
Arthur
Cleveland
Harrison
Cleveland
McKinley
Roosevelt
Taft
Wilson
Harding
Coolidge
Hoover
Roosevelt
Truman
Eisenhower
Kennedy
Johnson
Nixon
Ford
Carter
Reagan".Split('\n')[int.Parse(Console.ReadLine()) - 1]);
        }
    }
}


using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Numerics;
using System.Collections.Generic;
using System.Linq;
using System;

namespace bla2
{
    class Program
    {
        static void Main()
        {
            //Random rand = new Random();

            string[] s = Console.ReadLine().Split();
            l = long.Parse(s[0]);
            r = long.Parse(s[1]);
            x = long.Parse(s[2]);
            y = long.Parse(s[3]);
            //while (true)
            {
                Solve();
                //x = rand.Next(1, 1000000000);
                //y = x * rand.Next(1, 1000000000 / (int)x);
                //l = rand.Next(1, 1000000000);
                //r = rand.Next(1, 1000000000);
            }
        }

        static void Solve()
        {
            List<long> yfactors = Factor(y);
            yf = new List<long>();
            long x2 = x;
            long f = -1;
            for (int i = 0; i < yfactors.Count; i++)
            {
                if (x2 % yfactors[i] == 0)
                {
                    x2 /= yfactors[i];
                }
                else if (yf.Count != 0 && yfactors[i] == f)
                {
                    yf[yf.Count - 1] *= yfactors[i];
                }
                else
                {
                    yf.Add(yfactors[i]);
                    f = yfactors[i];
                }
            }
            if (x2 != 1)
            {
                Console.WriteLine("0");
            }
            else
            {
                Console.WriteLine(Count(new bool[yf.Count], 0));
            }
        }

        static long x, y, r, l;
        static List<long> yf;

        public static long Count(bool[] b, long at)
        {
            if(at == b.Length)
            {
                //Console.WriteLine(string.Join(", ", b));
                long n = x, m = x;
                for (int i = 0; i < b.Length; i++)
                {
                    if (b[i])
                        n *= yf[i];
                    else
                        m *= yf[i];
                }
                if (n <= r && n >= l && m <= r && m >= l)
                {
                    //Console.WriteLine(n + ", " + m);
                    return 1;
                }
                else
                    return 0;
            }
            long e = 0;
            bool[] nb = new bool[b.Length];
            Array.Copy(b, nb, b.Length);
            nb[at] = false;
            e += Count(nb, at + 1);
            nb[at] = true;
            e += Count(nb, at + 1);
            return e;
        }

        public static List<long> Factor(long n)
        {
            List<long> r = new List<long>();

            while (n % 2 == 0)
            {
                n /= 2;
                r.Add(2);
            }
            while (n % 3 == 0)
            {
                n /= 3;
                r.Add(3);
            }

            long sqrtn = (long)(Math.Sqrt(n)) + 1;
            long i = 6;
            while (n > 1 && i <= sqrtn)
            {
                bool nc = false;
                long a;
                while ((a = n % (i - 1)) == 0)
                {
                    r.Add(i - 1);
                    n /= i - 1;
                    nc = true;
                }
                while ((a = n % (i + 1)) == 0)
                {
                    r.Add(i + 1);
                    n /= i + 1;
                    nc = true;
                }
                i += 6;
                if (nc)
                    sqrtn = (long)(Math.Sqrt(n)) + 1;
            }
            if (n != 1) r.Add(n);
            return r;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using static Template;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pi = Pair<int, int>;

class Solver
{
    Scanner sc = new Scanner();
    //
    public void Solve()
    {
        int l, r, x, y;
        sc.Make(out l, out r, out x, out y);
        var fx = Factorize(x);
        var fy = Factorize(y);
        foreach (var p in fx)
        {
            if (!fy.ContainsKey(p.Key)||fy[p.Key]<p.Value)
                Fail(0);
        }
        var n = new List<P>();
        foreach (var p in fy)
        {
            if (!fx.ContainsKey(p.Key)) fx[p.Key] = 0;
            n.Add(new P(p.Key, p.Value, fx[p.Key]));
        }
        var res = 0;
        var ok = new Dictionary<long, Dictionary<long, bool>>();
        for(var i = 0; i < (1 << n.Count); i++)
        {
            long u = 1, v = 1;
            for(var j=0;j<n.Count;j++)
                if ((1 & i >> j) == 1)
                {
                    for (var k = 0; k < n[j].x; k++)
                        u *= n[j].v;
                    for (var k = 0; k < n[j].y; k++)
                        v *= n[j].v;
                }
                else
                {
                    for (var k = 0; k < n[j].x; k++)
                        v *= n[j].v;
                    for (var k = 0; k < n[j].y; k++)
                        u *= n[j].v;
                }
            if (r < u || u < l || r < v || v < l) continue;
            if (!ok.ContainsKey(u))
                ok[u] = new Dictionary<long, bool>();
            if (!ok[u].ContainsKey(v))
            {
                res++;
                ok[u][v] = true;
            }
        }
        WriteLine(res);
    }
    struct P
    {
        public long v, x, y;
        public P(long V,int X,int Y)
        {
            v = V;x = X;y = Y;
        }
    }

    public static Dictionary<long, int> Factorize(long num)
    {
        var dic = new Dictionary<long, int>();
        for (var i = 2L; i * i <= num; i++)
        {
            var ct = 0;
            while (num % i == 0)
            {
                ct++;
                num /= i;
            }
            if (ct != 0) dic[i] = ct;
        }
        if (num != 1) dic[num] = 1;
        return dic;
    }
}

#region Template
public class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == 1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T>
    { if (a.CompareTo(b) == -1) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b)
    { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f();
        return rt;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static T[] Create<T>(int n, Func<int, T> f)
    {
        var rt = new T[n];
        for (var i = 0; i < rt.Length; ++i)
            rt[i] = f(i);
        return rt;
    }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}

public class Scanner
{
    public string Str => ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    public Pair<T1, T2> PairMake<T1, T2>() => new Pair<T1, T2>(Next<T1>(), Next<T2>());
    public Pair<T1, T2, T3> PairMake<T1, T2, T3>() => new Pair<T1, T2, T3>(Next<T1>(), Next<T2>(), Next<T3>());
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
}

public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Tie(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Tie(out T1 a, out T2 b, out T3 c) { Tie(out a, out b); c = v3; }
}
#endregion


using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Debug = System.Diagnostics.Trace;
using SB = System.Text.StringBuilder;
using System.Numerics;
using static System.Math;
using Number = System.Int64;
using N = System.Int64;
using C = System.Int32;
namespace Program {
	public class Solver {
		Random rnd = new Random();
		public void Solve() {
			var n = ri;
			var k = ri;
			// TGLTGLTGL...RRRRRRRRTTGRTGTGT....TG
			// throw:n n+1
			// G: n
			// move: L or R + n-1
			var ans = 3 * n;
			ans += Min(k - 1, n - k);
			Console.WriteLine(ans);

		}
		const long INF = 1L << 60;
		static int[] dx = { -1, 0, 1, 0 };
		static int[] dy = { 0, 1, 0, -1 };
		int ri { get { return sc.Integer(); } }
		long rl { get { return sc.Long(); } }
		double rd { get { return sc.Double(); } }
		string rs { get { return sc.Scan(); } }
		public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());

		static T[] Enumerate<T>(int n, Func<int, T> f) {
			var a = new T[n];
			for (int i = 0; i < a.Length; ++i) a[i] = f(i);
			return a;
		}
		static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
	}
}

#region main
static class Ex {
	static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
	static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
		return string.Join(st, ie);
	}
	static public void Main() {
		//Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = false });
		var solver = new Program.Solver();
		solver.Solve();
		Console.Out.Flush();
	}
}
#endregion
#region Ex
namespace Program.IO {
	using System.IO;
	using System.Text;
	using System.Globalization;

	public class Printer : StreamWriter {
		public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
		public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
	}

	public class StreamScanner {
		public StreamScanner(Stream stream) { str = stream; }

		public readonly Stream str;
		private readonly byte[] buf = new byte[1024];
		private int len, ptr;
		public bool isEof = false;
		public bool IsEndOfStream { get { return isEof; } }

		private byte read() {
			if (isEof) return 0;
			if (ptr >= len) {
				ptr = 0;
				if ((len = str.Read(buf, 0, 1024)) <= 0) {
					isEof = true;
					return 0;
				}
			}
			return buf[ptr++];
		}

		public char Char() {
			byte b = 0;
			do b = read(); while ((b < 33 || 126 < b) && !isEof);
			return (char)b;
		}
		public string Scan() {
			var sb = new StringBuilder();
			for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);
			return sb.ToString();
		}
		public string ScanLine() {
			var sb = new StringBuilder();
			for (var b = Char(); b != '\n' && b != 0; b = (char)read()) if (b != '\r') sb.Append(b);
			return sb.ToString();
		}
		public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
		public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
		public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
	}
}

#endregion


using System;
using System.Collections.Generic;
namespace BasicProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(nk[0]);
            int k = Convert.ToInt32(nk[1]);
            Console.WriteLine(3 * n + Math.Min(k - 1, n - k));

        }
    }
}


using System;
using System.Collections.Generic;

namespace CrokContest
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split();
            int a = int.Parse(arr[0]);
            int n = int.Parse(arr[1]);

            int end = a + n -1;

            int sqrLen = 1;
            int[] table = new int[3163];
            table[0] = 1;
            for (int i = 1; table[i-1] < end; ++i, ++sqrLen)
                table[i] = 1 + i*2 + table[i -1];

            int max = end+1;
            int[] sqrs = new int[max];
            for (int i = 0; i < sqrLen; ++i)
            {
                for (int j = table[i]; j < max; j += table[i])
                {
                    sqrs[j] = table[i];
                }
            }

            decimal sum = 0;
            for (int i = a; i <= end; ++i)
            {
                sum += i / sqrs[i];
            }
            Console.Write(sum);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace _114a
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                //s = @"50 5".Split(cs, StringSplitOptions.RemoveEmptyEntries);
                s = new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return s[i++];
            }

            public int nextInt()
            {
                return int.Parse(next());
            }

            public long nextLong()
            {
                return long.Parse(next());
            }
        }

        static void Main(string[] args)
        {
            Hren h = new Hren();
            h.Go();
        }

        class Hren
        {
            public void Go()
            {
                Scanner sc = new Scanner();
                int a = sc.nextInt();
                int n = sc.nextInt();

                int[] lst = new int[a + n];

                for (int i = 0; i < a + n; i++)
                {
                    lst[i] = 0;
                }

                for (int i = 2; i <= 3162; i++)
                {
                    int res = 0;
                    int lim = (a + n) / (i * i);
                    for(int j = 1; j< lim + 2; j++)
                    {
                        res = j * i * i;
                        if (res < a + n && res > 0)
                        {
                            lst[res] = j;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                long result = 0;
                for (int i = a; i < a + n; i++ )
                {
                    if (lst[i] != 0)
                    {
                        result += lst[i];
                    }
                    else
                    {
                        result += i;
                    }
                }

                Console.WriteLine(result);
            }
        }
    }

}


using System;

namespace prog
{
    class Program
    {
        static void Main()
        {
            string s;
            int i;
            char c;

            s = Console.ReadLine();
            s = s.ToUpper();
            for(i = s.Length - 1; s[i] == ' ' || s[i] == '?'; i--);
            c = s[i];
            if (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U' || c == 'Y')
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A49
{
    class Program
    {
        static void Main(string[] args)
        {
            String s = Console.ReadLine();
            s = s.Remove(s.Length-1,1).Trim().ToUpper();
            switch (s[s.Length-1])
            {
                case 'A':
                    Console.Write("YES");
                    break;
                case 'E':
                    Console.Write("YES");
                    break;
                case 'I':
                    Console.Write("YES");
                    break;
                case 'O':
                    Console.Write("YES");
                    break;
                case 'U':
                    Console.Write("YES");
                    break;
                case 'Y':
                    Console.Write("YES");
                    break;

                default:
                    Console.Write("NO");

                    break;
            }

        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Codeforces
{
    class Program
    {
        static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }
        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        static void ReadIntArray(out int[] array, char separator = ' ')
        {
            var input = Console.ReadLine().Split(separator);
            array = new int[input.Length];
            for (int i = 0; i < input.Length; i++)
            {
                array[i] = Int32.Parse(input[i]);
            }

        }

        static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        static void Main()
        {
            var n = ReadLong();
            var k = ReadLong();
            int res = 0;
            while (k != 1 && k % n == 0)
            {
                k /= n;
                res++;
            }
            if (k != 1)
                Console.WriteLine("NO");
            else
            {
                Console.WriteLine("YES");
                Console.WriteLine(res - 1);
            }
        }
    }
}


using System;

namespace Achill
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = int.Parse(Console.ReadLine());
            int l = int.Parse(Console.ReadLine()), res = 0;
            bool flag = k == l;
            double tmp = 1.0 * l / k;
            while(tmp > 1 && tmp == (int)tmp)
            {
                tmp /= k;
                ++res;
            }
            if(tmp == 1)
            {
                Console.WriteLine("YES");
                Console.WriteLine(res);
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


using System;

namespace Number266A {
    class Program {
        static void Main(string[] args) {
            Int32 count = Int32.Parse(Console.ReadLine());
            Int32 counter = 0;
            Char previousCymbol = (Char)Console.Read();
            for(Int32 i = 1; i < count; i++) {
                Char symbol = (Char)Console.Read();
                if(symbol == previousCymbol)
                    counter++;
                previousCymbol = symbol;
            }
            Console.WriteLine(counter);
        }
    }
}


using System;

namespace temp
{

    class Program
    {
        private static void Main()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string input = Console.ReadLine();
            int c = 0;
            for (int i = 0; i < n; i++)
            {
                if (i+1 < n && input[i] == input[i + 1])
                {
                    c++;
                }
            }
            Console.WriteLine(c);
        }
    }

}


// Straight «A» - CodeForces
// Status: Unsolved

using System;

namespace ConsoleApp {
  class Program {

    static Func<int[]> invr =
      () => Array.ConvertAll(Console.ReadLine().Split(' '),
        int.Parse);

    static bool val(int a, int k, int n1, int n2) {
      return ((a + (k * n2)) / ((n1 + n2) * (k - 0.5f))) < 1;
    }

    static int Main(string[] args) {
      int[] input = invr();
      int n = input[0], k = input[1];
      int[] a = invr();
      int aa = 0;

      foreach (int nn in a) {
        aa += nn;
      }

      float x = ((k - aa) / 0.5f) - n;
      int i = 0;
      while (val(aa, k, n, i))i++;
      Console.WriteLine(i);
      return 0;
    }
  }
}


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Security.Principal;
using System.Text;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Collections;
using System.Text.RegularExpressions;

namespace Task
{

    #region MyIo

    internal class MyIo : IDisposable
    {
#if  LOCAL_TEST
        private readonly TextReader inputStream = new StreamReader("input.txt");
#else
        private readonly TextReader inputStream = Console.In;
#endif
#if  FBHC_TEST
        private readonly TextWriter outputStream = new StreamWriter("output.txt");
#else
        private readonly TextWriter outputStream = Console.Out;
#endif

        private string[] tokens;
        private int pointer;

        public char NextChar()
        {
            try
            {
                var c = inputStream.Read();

                if (c < 0)
                    c = 0;

                return (char)c;
            }
            catch (IOException)
            {
                return '\0';
            }
        }

        public string NextLine()
        {
            try
            {
                return inputStream.ReadLine();
            }
            catch (IOException)
            {
                return null;
            }
        }

        public string NextString()
        {
            try
            {
                while (tokens == null || pointer >= tokens.Length)
                {
                    tokens = (NextLine() + string.Empty).Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    pointer = 0;
                }
                return tokens[pointer++];
            }
            catch (IOException)
            {
                return null;
            }
        }

        public int NextInt()
        {
            return Next<int>();
        }

        public long NextLong()
        {
            return Next<long>();
        }

        public T Next<T>()
        {
            var t = typeof(T);

            if (t == typeof(char))
                return (T)(object)NextChar();

            object s = NextString();

            if (t == typeof(string))
                return (T)s;

            return (T)Convert.ChangeType(s, typeof(T));
        }

        public IEnumerable<T> NextWhile<T>(Predicate<T> pred)
        {
            if (pred == null)
                yield break;

            var res = Next<T>();

            while (pred(res))
            {
                yield return res;

                res = Next<T>();
            }
        }

        public IEnumerable<T> NextSeq<T>(long n)
        {
            for (var i = 0; i < n; i++)
                yield return Next<T>();
        }

        public void Print(string format, params object[] args)
        {
            outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));
        }

        public void PrintLine(string format, params object[] args)
        {
            Print(format, args);

            outputStream.WriteLine();
        }

        public void Print(bool o)
        {
            Print(o ? "YES" : "NO");
        }

        public void PrintLine(bool o)
        {
            Print(o);

            outputStream.WriteLine();
        }

        public void Print<T>(T o)
        {
            var ienum = o as IEnumerable;

            if (ienum != null && typeof(T) != typeof(string))
            {
                var first = true;

                foreach (var iev in ienum)
                {
                    if (!first && iev != null)
                        Print(" ");

                    Print(iev);

                    first = false;
                }

            }
            else
            {
                outputStream.Write(Convert.ToString(o, CultureInfo.InvariantCulture));
            }

        }

        public void PrintLine<T>(T o)
        {
            Print(o);

            outputStream.WriteLine();
        }

        public void Close()
        {
            inputStream.Close();
            outputStream.Close();
        }

        void IDisposable.Dispose()
        {
            Close();

#if  LOCAL_TEST
            Console.ReadLine();
#endif
        }
    }

    public static class ListExtensions
    {
        public static void Each<T>(this IEnumerable<T> self, Action<T> action)
        {
            foreach (var v in self)
                action(v);
        }

        public static string Reverse(this string s)
        {
            var charArray = s.ToCharArray();
            Array.Reverse(charArray);
            return new string(charArray);
        }

        public static IEnumerable<T> ToCycleEnumerable<T>(this IEnumerable<T> self)
        {
            if (self != null)
            {
                for (; ; )
                {
                    foreach (var x in self)
                        yield return x;
                }
            }
        }

        public static T CycleGet<T>(this IList<T> self, int index)
        {
            var c = self.Count;
            return self[(index % c + c) % c];
        }

        public static long MODPower(this int x, long y, long mod)
        {
            long answ = 1;

            if (y == 0)
                return answ;
            if (y % 2 == 1)
                answ *= x;

            answ *= MODPower(x, y / 2, mod) * MODPower(x, y / 2, mod);

            answ %= mod;

            return answ;
        }

        public static IList<T> Shuffle<T>(this IList<T> self)
        {
            var rnd = new Random(DateTime.Now.Millisecond);

            var n = self.Count;

            while (n > 1)
            {
                n--;
                var k = rnd.Next(n + 1);
                var value = self[k];
                self[k] = self[n];
                self[n] = value;
            }

            return self;
        }

        public static IList<IList<T>> UseForNew2D<T>(this T def, int fd, int sd)
        {
            var fdim = new T[fd][];

            for (int i = 0; i < fd; i++)
            {
                fdim[i] = new T[sd];
                Fill(fdim[i], def);
            }

            return fdim;
        }

        public static IList<T> Fill<T>(this IList<T> self, Func<int, IList<T>, T> fval)
        {
            for (var i = 0; i < self.Count; i++)
                self[i] = fval(i, self);

            return self;
        }

        public static IList<T> Fill<T>(this IList<T> self, Func<int, T> fval)
        {
            return self.Fill((x, slf) => fval(x));
        }

        public static IList<T> Fill<T>(this IList<T> self, Func<T> fval)
        {
            return self.Fill(x => fval());
        }

        public static IList<T> Fill<T>(this IList<T> self, T val)
        {
            return self.Fill(() => val);
        }

        public static long Hash<T>(this IList<T> self, Func<T, long> val = null)
        {
            return val != null ? self.Hash((t, current) => unchecked(current * 19L + val(t))) : self.Hash(HashOne);
        }

        public static long Hash<T>(this IList<T> self, Func<T, long, long> val)
        {
            return self.Aggregate(0L, (current, t) => unchecked(val(t, current)));
        }

        public static long HashOne<T>(this T self, long current)
        {
            return unchecked(current * 19L + (Equals(self, default(T)) ? 0 : self.GetHashCode()));
        }

        public static IList<T1> BuildSegTree<T1, T2>(this IList<T2> a, Func<T1, T1, T1> combine, Func<T2, T1> convert)
        {
            var t = new T1[a.Count << 2];

            a.BuildSegTree(t, 1, 0, a.Count - 1, combine, convert);

            return t;
        }

        private static void BuildSegTree<T1, T2>(this IList<T2> a, IList<T1> t, int v, int tl, int tr, Func<T1, T1, T1> combine, Func<T2, T1> convert)
        {
            if (tl == tr)
            {
                t[v] = convert(a[tl]);
            }
            else
            {
                int tm = (tl + tr) >> 1;

                BuildSegTree(a, t, v << 1, tl, tm, combine, convert);
                BuildSegTree(a, t, (v << 1) + 1, tm + 1, tr, combine, convert);

                t[v] = combine(t[v << 1], t[(v << 1) + 1]);
            }
        }

        public static int Xor1n(this int n)
        {
            return (n >> 1) & 1 ^ ((n & 1) > 0 ? 1 : n);
        }
    }

    public static class P
    {
        public static P<T1, T2> Create<T1, T2>(T1 key, T2 val)
        {
            return new P<T1, T2>(key, val);
        }
    }

    public class P<T1, T2>
    {
        private class PComparer : IComparer<P<T1, T2>>
        {
            private readonly bool? byKey;

            public PComparer(bool? byKey)
            {
                this.byKey = byKey;
            }

            public int Compare(P<T1, T2> x, P<T1, T2> y)
            {
                x = x ?? new P<T1, T2>();
                y = y ?? new P<T1, T2>();

                if (byKey == true)
                    return Comparer<T1>.Default.Compare(x.Key, y.Key);
                else if (byKey == false)
                    return Comparer<T2>.Default.Compare(x.Value, y.Value);
                else
                {
                    var tr = Comparer<T1>.Default.Compare(x.Key, y.Key);

                    if (tr != 0)
                        tr = Comparer<T2>.Default.Compare(x.Value, y.Value);

                    return tr;
                }
            }
        }

        public P()
        {
        }

        public P(T1 key, T2 val)
        {
            this.Key = key;
            this.Value = val;
        }

        public T1 Key
        {
            get;
            set;
        }

        public T2 Value
        {
            get;
            set;
        }

        public P<T1, T2> Clone()
        {
            return new P<T1, T2>(Key, Value);
        }

        public static IComparer<P<T1, T2>> KeyComparer
        {
            get { return new PComparer(true); }
        }

        public static IComparer<P<T1, T2>> ValueComparer
        {
            get { return new PComparer(false); }
        }

        public static implicit operator T1(P<T1, T2> obj)
        {
            return obj.Key;
        }

        public static implicit operator T2(P<T1, T2> obj)
        {
            return obj.Value;
        }

        public P<T1, T2> SetKey(T1 key)
        {
            Key = key;
            return this;
        }

        public P<T1, T2> SetValue(T2 value)
        {
            Value = value;
            return this;
        }

        public override string ToString()
        {
            return string.Format("Key: {0}, Value: {1}", Key, Value);
        }

        public override bool Equals(object obj)
        {
            var co = obj as P<T1, T2>;

            return co != null && co.GetHashCode() == GetHashCode();
        }

        public override int GetHashCode()
        {
            int hash = 17;
            hash = unchecked(hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode()));
            hash = unchecked(hash * 31 + ((Equals(Value, default(T1))) ? 0 : Value.GetHashCode()));
            return hash;

        }
    }

    #endregion

    internal class Program
    {
        #region Program

        private readonly MyIo io;

        public Program(MyIo io)
        {
            this.io = io;
        }

        public static void Main(string[] args)
        {
            using (var io = new MyIo())
            {
                try
                {
                    new Program(io)
                        .Solve();
                }
                catch (Exception e)
                {
                    io.PrintLine(e.Message + "\r\n" + e.StackTrace);

                    throw;
                }
            }
        }

        #endregion

        public const long MOD = 1000000007;
        public const double EPS = 1e-14;

        private void Solve()
        {
            var n = io.NextInt();
            var k = io.NextInt();

            var a = io.NextSeq<long>(n).ToList();
            var sm = (double)a.Sum();
            var cnt = 0;
            double x;

            do
            {
                x = sm / (n + cnt);
                sm += k;
                cnt++;
            } while (x < k  - 0.5);

            io.PrintLine(cnt - 1);
        }

    }

}


using System; using System.Linq;

class P {
  static void Main () {
    var s = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var a = s[0]; var b = s[1]; var c = s[2];
    var res = Enumerable.Range(0,1000000).First(x => a*c <= b*(c+x));
    Console.Write(res);
  }
}


using System;
using System.Linq;

namespace LetsWatchFootball
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray<int>();
            int temp = (input[0] * input[2]) - (input[1] * input[2]);
            int seconds = 0;
            while (seconds * input[1] < temp)
                seconds++;
            Console.WriteLine(seconds);
            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            long ty = 0, tb = 0, y = 0, g = 0, b = 0, t = 0;
            string tmp1=Console.ReadLine();
            //cin >> ty >> tb;
            string[] t1 = tmp1.Split(' ');
            ty = long.Parse(t1[0]);
            tb = long.Parse(t1[1]);
            string tmp2 = Console.ReadLine();
            t1 = tmp2.Split(' ');
            y = long.Parse(t1[0]);
            g = long.Parse(t1[1]);
            b = long.Parse(t1[2]);
            //cin >> y >> g >> b;
            ty = ty - g; tb = tb - g;
            if (ty - y * 2 < 0)
            {
                t = t + (y * 2 - ty);
                ty = 0;
            }
            else
            {
                ty = ty - y * 2;
            }

            if (tb - b * 3 < 0)
            {
                t = t + (b * 3 - tb); tb = 0;
            }
            else
            {
                tb = tb - b * 3;
            }
           // if (t < 0)
              //  t = -1 * t;
            Console.Write(t);
        }
    }
}


using System;

namespace CSharp
{
    public class _912A
    {
        public static void Main()
        {
            string[] tokens = Console.ReadLine().Split();

            long a = long.Parse(tokens[0]);
            long b = long.Parse(tokens[1]);

            tokens = Console.ReadLine().Split();

            long x = long.Parse(tokens[0]);
            long y = long.Parse(tokens[1]);
            long z = long.Parse(tokens[2]);

            Console.WriteLine(Math.Max(0, 2 * x + y - a) + Math.Max(0, y + 3 * z - b));
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Globalization;

#if DEBUG
using System.Diagnostics;
#endif

namespace CompetitiveProgramming
{
    class Program
    {
        static bool s_IsMultipleTestCases = false;
        static void Main(string[] args)
        {
#if DEBUG
            var streamReader = new StreamReader("../../input.txt", Encoding.ASCII, false, 32768);
            var streamWriter = new StreamWriter("../../output.txt", false, Encoding.ASCII, 32768);
            var timer = new Stopwatch();
            timer.Start();
#else
            var streamReader = new StreamReader(Console.OpenStandardInput(32768), Encoding.ASCII, false, 32768);
            var streamWriter = new StreamWriter(Console.OpenStandardOutput(32768), Encoding.ASCII, 32768);
#endif
            var reader = new InputReader(streamReader);

            var numberOfTest = 1;
            if (s_IsMultipleTestCases)
            {
                numberOfTest = reader.NextInt();
            }
            for (var testNumber = 1; testNumber <= numberOfTest; ++testNumber)
            {
                Task solver = new Task();
                solver.Solve(testNumber, reader, streamWriter);
            }
#if DEBUG
            streamWriter.WriteLine("\nEslapsed Time: " + timer.ElapsedMilliseconds + " ms");
#endif
            streamReader.Close();
            streamWriter.Close();
        }
    }

    class Task
    {
        public void Solve(int testNumber, InputReader reader, StreamWriter writer)
        {
            var s = reader.Next().Split(':');
            var min = reader.NextInt();
            var timeSpan = new TimeSpan(int.Parse(s[0]), int.Parse(s[1]), 0);
            var ans = timeSpan.Add(new TimeSpan(0, min, 0));
            writer.WriteLine(ans.ToString(@"hh\:mm"));
        }
    }

    class InputReader
    {
        private char[] _inbuf;
        private int _lenbuf = 0, _ptrbuf = 0;
        private StreamReader _reader;

        public InputReader(StreamReader reader)
        {
            _reader = reader;
            _inbuf = new char[1024];
            _lenbuf = 0;
            _ptrbuf = 0;
        }

        private int ReadByte()
        {
            if (_lenbuf == -1)
                throw new Exception();
            if (_ptrbuf >= _lenbuf)
            {
                _ptrbuf = 0;
                try
                {
                    _lenbuf = _reader.Read(_inbuf, 0, 1024);
                }
                catch (IOException e)
                {
                    throw e;
                }
                if (_lenbuf <= 0)
                    return -1;
            }
            return _inbuf[_ptrbuf++];
        }

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

        private int Skip()
        {
            int b;
            while ((b = ReadByte()) != -1 && IsSpaceChar(b)) ;
            return b;
        }

        public int NextInt()
        {
            int num = 0, b;
            var 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();
            }
        }

        public long NextLong()
        {
            long num = 0, b;
            var 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();
            }
        }

        public string Next()
        {
            var b = Skip();
            var sb = new StringBuilder();
            while (!(IsSpaceChar(b)))
            {
                sb.Append((char)b);
                b = ReadByte();
            }
            return sb.ToString();
        }

        public double NextDouble()
        {
            return double.Parse(Next(), CultureInfo.InvariantCulture);
        }
    }

}


using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

class Program
{
    public void Solve()
    {
        var S = Reader.String();
        int h = int.Parse(S.Substring(0, 2));
        int m = int.Parse(S.Substring(3));
        m += Reader.Int();
        h += m / 60;
        m %= 60;
        h %= 24;
        Console.WriteLine(h.ToString("d2") + ":" + m.ToString("d2"));
        Console.ReadLine();
    }
}

class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    private static TextReader reader = Console.In;
    private static readonly char[] separator = { ' ' };
    private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    private static string[] A = new string[0];
    private static int i;
    private static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); }
    public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); }
    public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Next()).ToArray(); }
    public static string Line() { return reader.ReadLine().Trim(); }
    private static string[] Split(string s) { return s.Split(separator, op); }
    private static string Next() { CheckNext(); return A[i++]; }
    private static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Code
{
    class Program
    {
        public static int[] a;
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int n = int.Parse(s.Split(' ')[0]), x = int.Parse(s.Split(' ')[1]);
            s = Console.ReadLine();
            bool[] b = new bool[x+1];
            for (int i = 0; i < x; i++)
                b[i] = false;
            foreach (string s1 in s.Split(' '))
            {
                if (int.Parse(s1)<= x)
                b[int.Parse(s1)] = true;
            }
            int c = 0;
            for (int i=0; i<x; i++)
            {
                if (!b[i])
                    c++;
            }
            if (b[x])
                c++;
            Console.WriteLine(c);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace r435__sharp_
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = 0; // количество операций

            int n, x;
            string s = Console.ReadLine();
            string[] str = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            n = int.Parse(str[0]);
            x = int.Parse(str[1]);

            s = Console.ReadLine();
            str = s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int[] ar = new int[n];

            for (int i = 0; i < n; i++)
            {
                ar[i] = int.Parse(str[i]);
            }

            for (int i = 0; i < n; i++)
            {
                if (x == ar[i])
                {
                    k++;
                }
            }

            int t = 0;
            for (int i = 0; i < n; i++)
            {
                if (ar[i] < x)
                    t++;
                            }

            k += (x - t);

            Console.WriteLine(k);
        }
    }
}


using System;
using System.Collections;
using System.Text;
namespace p2
{
    class Program
    {
        public static int Main(string[] args)
        {  string[] line =Console.ReadLine().Split();
            int n,m,a;
            n=int.Parse(line[0]);
            if(n<=10){Console.WriteLine("0");return 0;}
            if(n-10<10){Console.WriteLine("4");return 0;}
            if(n-10==10){Console.WriteLine("15");return 0;}
            if(n-10==11){Console.WriteLine("4");return 0;}
            Console.WriteLine("0");
            //Console.ReadKey();
            return 0;
        }

    }
    }


using System;
using System.Collections.Generic;
using System.Text;

namespace CodeForse80
{

    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int dim = n - 10;
            if (dim <= 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                if (dim == 10)
                {
                    Console.WriteLine(15);
                }
                else if (dim > 11)
                {
                    Console.WriteLine(0);
                }
                else
                {
                    Console.WriteLine(4);
                }
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.IO;

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public int c;
    public PairVariable()
    {
        a = b = 0;
        c = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
        c = 0;

    }

    public PairVariable(int a, int b, int c)
    {
        this.a = a;
        this.b = b;
        this.c = c;

    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;
    }

    public int CompareTo(PairVariable other)
    {
        return this.a.CompareTo(other.a);
    }
}
namespace ConsoleApplication1
{
    class Program
    {

        static char[,] s = new char[10, 10];

        static List<PairVariable> position = new List<PairVariable>();

        static void Main(string[] args)
        {

            for (int i = 1; i <= 8; i++)
            {
                string q = Console.ReadLine();

                for (int e = 1; e <= 8; e++)
                {
                    s[i, e] = q[e - 1];
                }
            }

                for (int i = 1; i <= 8; i++)
                {
                    for (int e = 1; e <= 8; e++)
                    {
                        if (s[i, e] == 'S')
                        {
                            s[i, e] = '.';
                            position.Add(new PairVariable(i, e));
                        }
                    }
                }
                int x = 8;
                int y = 1;
                List<PairVariable> d = new List<PairVariable>();
                d.Add(new PairVariable(x, y));
                for (int i = 0; i < 8; i++)
                {
                    if (d.Count == 0)
                    {
                        Console.WriteLine("LOSE");
                        return;
                    }
                    int kk = d.Count;
                    for (int e = 0; e < kk; e++)
                    {
                        int xx = d[e].a;
                        int yy = d[e].b;
                        int x1 = xx - 1;
                        int y1 = yy;
                        bool q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }
                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                        x1 = xx - 1;
                        y1 = yy - 1;
                        q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }
                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                        x1 = xx - 1;
                        y1 = yy + 1;

                        q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }

						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }

                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                        x1 = xx;
                        y1 = yy + 1;
                        q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }
                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                        x1 = xx;
                        y1 = yy - 1;
                        q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }
                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                        x1 = xx+1;
                        y1 = yy - 1;
                        q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }
                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                        x1 = xx+1;
                        y1 = yy + 1;
                        q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }
                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                        x1 = xx+1;
                        y1 = yy;
                        q = true;
                        for (int j = 0; j < position.Count; j++)
                        {
                            if (position[j].a == x1 && position[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
						for (int j = 0; j < d.Count; j++)
                        {
                            if (d[j].a == x1 && d[j].b == y1)
                            {
                                q = false;
								break;
                            }
                        }
                        if (s[x1, y1] != '.')
                        {
                            q = false;
                        }
                        if (q)
                        {
                            d.Add(new PairVariable(x1, y1));
                        }
                    }
                    for (int e = 0; e < position.Count; e++)
                    {
                        position[e].a++;
                    }

                    for (int e = 0; e < position.Count; e++)
                    {
                        for (int j = 0; j < d.Count; j++)
                        {
                            if (position[e].a == d[j].a && position[e].b == d[j].b)
                            {
                                d.RemoveAt(j);
                            }

                        }
                    }

                }
                Console.WriteLine("WIN");

        }
    }
}


using System;
using System.Text;
using System.IO;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;

class App {
	static void Main() {
		var field = new List<char[]> {
			"........".ToCharArray(),
			"........".ToCharArray(),
		};

		for (int i = 0 ; i < 8 ; i++) field.Add(Console.ReadLine().Replace('A', '.').ToCharArray());

		var queue = new List<Tuple<int, int>> {
			Tuple.Create(9, 0),
		};

		Action<int, int> tryMove = (y, x) => {
			if (x < 0 || x > 7 || y > 9) return;
			if (field[y][x] == 'S' || field[y-1][x] == 'S') return;
			if (field[y-1][x] == 'M') return;
			field[y-1][x] = 'M';
			queue.Add(Tuple.Create(y - 1, x));
		};

		for (int i = 0 ; i < queue.Count ; i++) {
			var move = queue[i];
			var y = move.Item1;
			var x = move.Item2;
			if (y < 2) {
				Console.WriteLine("WIN");
				return;
			}
			for (int ny = y - 1 ; ny <= y + 1 ; ny++)
			for (int nx = x - 1 ; nx <= x + 1 ; nx++)
				tryMove(ny, nx);
		}
		Console.Write("LOSE");
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;

namespace ConsoleApplication1
{
    class cf384_2
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader(@"D:\Sergey\Code\1.txt"));

            string[] strParams = Console.ReadLine().Split(new char[] { ' ' });
            int n = int.Parse(strParams[0]);
            ulong k = ulong.Parse(strParams[1]);

            Console.WriteLine(GetNum(k, n));
        } // Main

        static int GetNum(ulong k, int n)
        {
            if (n == 1)
                return 1;

            ulong len = (ulong)Math.Pow(2, n) - 1;
            if ((len / 2 + 1) == k)
                return n;

            if (k > (len / 2 + 1))
                k -= (len / 2 + 1);

            return GetNum(k, n -1);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Globalization;
using System.IO;
using System.Linq;
//Гавно код недорешенный
public class Source
{
    public void Program()
    {
    }
    void Read()
    {
        long n = ReadLong(), a = ReadLong();
        long size = 0;
        for (int i = 0; i < n; i++)
        {
            size += 1 + size;
        }
        long maxnum = n;
        while(true)
        {
            if (a != size / 2 + 1)
            {
                if (a > size / 2 + 1)
                    a -= size / 2 + 1;
                size /= 2;
                n--;
            }
            else
            { writeLine(n); return; }
        }
       // writeLine(l[a]);
    }

    #region hide it
    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
            reader = new StreamReader(Console.OpenStandardInput());
            writer = new StreamWriter(Console.OpenStandardOutput());
            //reader = new StreamReader("input.txt");
            //writer = new StreamWriter("output.txt");
#endif
        var source = new Source();
        source.Read();
        source.Program();

        /* try
         {
             new Source().Program();
         }
         catch (Exception ex)
         {
 #if DEBUG
             Console.WriteLine(ex);
 #else
             throw;
 #endif
         }*/
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }
    public static int ri() { return int.Parse(ReadToken()); }
    public static char ReadChar() { return char.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static ulong ReaduLong() { return ulong.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(i => int.Parse(i)).ToArray(); }
    public static char[] ReadCharArray() { return ReadAndSplitLine().Select(i => char.Parse(i)).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(i => long.Parse(i)).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }
    public static char[][] ReadCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadCharArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void write<T>(T value) { writer.Write(value); }
    public static void writeLine<T>(T value) { writer.WriteLine(value); }
    public static void writeArray<T>(T[] array, string split) { for (int i = 0; i < array.Length; i++) { write(array[i] + split); } }
    public static void writeMatrix<T>(T[][] matrix, string split) { for (int i = 0; i < matrix.Length; i++) { writeArray(matrix[i], split); writer.Write("\n"); } }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
    #endregion

    #region Methods
    #region DSU
    public void MakeSet(int[] poi)
    {
        for (int i = 0; i < poi.Length; i++)
        {
            poi[i] = i;
        }
    }
    public int Find(int x, int[] poi)
    {
        if (poi[x] == x) return x;
        return poi[x] = Find(poi[x], poi);
    }
    Random rand = new Random();
    public void Unite(int x, int y, int[] poi)
    {
        y = Find(y, poi);
        x = Find(x, poi);
        if (rand.Next() % 2 == 0)
            Swap(ref x, ref y);
        poi[x] = y;
    }
    #endregion

    class Deque<T>
    {
        T[] array;
        int start, length;
        public Deque()
        {
            start = 0; length = 0; array = new T[1];
        }
        public T this[int index] { get { return array[(start + index) % array.Length]; } set { array[(start + index) % array.Length] = value; } }
        int last { get { return (start + length) % array.Length; } }
        /// <summary>
        /// ÃÆÃ¢â¬ËÃâÃÂÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬Ã
        /// </summary>
        public T PeekFirst()
        {
            return array[start];
        }
        public int Count { get { return length; } }
        /// <summary>
        /// ÃÆÃÂÃâÃÂºÃÆÃÂÃâÃÂ¾ÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂµÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬  ÃÆÃÂÃâÃÂ±ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ· ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃ¢â¬ËÃâÃÂ
        /// </summary>
        public T PeekLsat()
        {
            return array[last];
        }
        public T PopLast()
        {
            if (length == 0)
                throw new IndexOutOfRangeException("OutOfRange");
            length--;
            return array[last];
        }
        public T PopFirst()
        {
            if (length == 0)
                throw new IndexOutOfRangeException("OutOfRange");
            length--;
            if (start >= array.Length - 1) start = 0; else start++;
            return array[start - 1 < 0 ? array.Length - 1 : start - 1];
        }
        public void AddFirst(T value)
        {
            IncreaseAndInspection();
            if (start <= 0) start = array.Length - 1; else start--;
            array[start] = value;
            length++;
        }
        public void AddLast(T value)
        {
            IncreaseAndInspection();
            array[last] = value;
            length++;
        }
        bool overflow { get { return length == array.Length; } }
        void IncreaseAndInspection()
        {
            if (overflow)
                increase();

        }
        void increase()
        {
            T[] array2 = new T[array.Length * 2];
            for (int i = 0; i < array.Length; i++)
            {
                int pos = (start + i) % array.Length;
                array2[i] = array[pos];
            }
            array = array2;
            start = 0;
            array2 = null;
        }
        public void Clear()
        {
            start = 0; length = 0; array = new T[1];
        }
    }
    class Heap<T>
    {
        Comparison<T> ic;
        List<T> storage = new List<T>();
        public Heap(Comparison<T> ic)
        {
            this.ic = ic;
        }
        public void Add(T element)
        {
            storage.Add(element);
            int pos = storage.Count - 1;
            while (pos != 0 && ic(storage[((int)(pos - 1) >> 1)], element) > 0)
            {
                Swap(storage, pos, ((int)(pos - 1) / 2));
                pos = ((int)(pos - 1) / 2);
            }
        }
        public T Pop()
        {
            T t = storage[0];
            Swap(storage, 0, storage.Count - 1);
            int pos = 0;
            storage.RemoveAt(storage.Count - 1);
            if (Count > 0)
                while (true)
                {
                    T my = storage[pos];
                    if (pos * 2 + 1 >= Count)
                        break;
                    T left = storage[pos * 2 + 1];
                    if (pos * 2 + 2 >= Count)
                    {
                        if (ic(left, my) < 0)
                        {
                            Swap(storage, pos, pos * 2 + 1);
                            pos = pos * 2 + 1;
                        }
                        break;
                    }
                    T right = storage[pos * 2 + 2];
                    if (ic(left, my) < 0 || ic(right, my) < 0)
                    {
                        if (ic(left, right) < 0)
                        {
                            Swap(storage, pos, pos * 2 + 1);
                            pos = pos * 2 + 1;
                        }
                        else
                        {

                            Swap(storage, pos, pos * 2 + 2);
                            pos = pos * 2 + 2;
                        }
                    }
                    else break;
                }
            return t;
        }

        public void Clear()
        {
            storage.Clear();
        }
        /// <summary>
        /// ÃÆÃÂÃâÃÂ±ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ· ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃ¢â¬ËÃâÃÂ
        /// </summary>
        /// <returns></returns>
        public T Peek()
        {
            return storage[0];
        }
        public int Count
        {
            get { return storage.Count; }
        }
        //void RemoveLast, Size, peeklast, add
    }
    static void Swap<T>(ref T lhs, ref T rhs)
    {
        T temp;
        temp = lhs;
        lhs = rhs;
        rhs = temp;
    }
    static void Swap<T>(T[] a, int l, int r)
    {
        T temp;
        temp = a[l];
        a[l] = a[r];
        a[r] = temp;
    }
    static void Swap<T>(List<T> a, int l, int r)
    {
        T temp;
        temp = a[l];
        a[l] = a[r];
        a[r] = temp;
    }

    bool outregion(long y, long x, long n, long m)
    {
        if (x < 0 || x >= m || y < 0 || y >= n)
            return true;
        return false;
    }
    static void initlist<T>(ref List<T>[] list, int n)
    {
        list = new List<T>[n];
        for (int i = 0; i < n; i++)
            list[i] = new List<T>();
    }
    static void newarray<T>(ref T[][] array, int n, int m)
    {
        array = new T[n][];
        for (int i = 0; i < n; i++)
            array[i] = new T[m];
    }
    static void newarray<T>(ref T[] array, int n)
    {
        array = new T[n];
    }
    static void fill<T>(T[] array, T value)
    {
        for (int i = 0; i < array.Length; i++)
            array[i] = value;
    }
    static void fill<T>(T[][] array, T value)
    {
        for (int i = 0; i < array.Length; i++)
            for (int j = 0; j < array[i].Length; j++)
                array[i][j] = value;
    }
    public bool NextPermutation<T>(T[] b, Comparison<T> ic)
    {
        for (int j = b.Length - 2; j >= 0; j--)
        {
            if (ic(b[j], b[j + 1]) < 0)
            {
                for (int l = b.Length - 1; l >= 0; l--)
                {
                    if (ic(b[l], b[j]) > 0)
                    {
                        Swap(b, j, l);
                        Array.Reverse(b, j + 1, b.Length - (j + 1));
                        return true;
                    }
                }
            }
        }
        return false;
    }
    int[,] step8 = new int[,]
    {
        {-1,0 },
        {1,0 },
        {0,-1 },
        {0,1 },
        {1,1 },
        {-1,1 },
        {-1,-1 },
        {1,-1 },
    };
    int[,] step4 = new int[,]
    {
        {-1,0 },
        {1,0 },
        {0,-1 },
        {0,1 },
    };
    struct Vector2
    {
        public double x;
        public double y;
        public Vector2(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
        public double Dist(Vector2 to)
        {
            return Math.Sqrt(Math.Abs(Math.Pow(to.x - x, 2)) + Math.Abs(Math.Pow(to.y - y, 2)));
        }
        public static bool operator ==(Vector2 left, Vector2 right) { return left.x == right.x && left.y == right.y; }
        public static bool operator !=(Vector2 left, Vector2 right) { return left.x != right.x || left.y != right.y; }
    }
    #endregion
    #endregion

}


using System;
using System.Linq;
public class Program
{
	public static void Main()
	{
		string word = Console.ReadLine();
		int lengthOfWord = word.Count();
		int upperCount = 0;
		foreach(char c in word){
			if(Char.IsUpper(c)){
				upperCount+=1;
			}
		}
		if((upperCount > lengthOfWord-upperCount)){
			Console.WriteLine(word.ToUpper());
		}else{
			Console.WriteLine(word.ToLower());
		}

	}
}


using System;
using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace URI_practice
{
   public class Program
    {
        static void Main(string[] args)
        {
            String str = Console.ReadLine();
            int upper = 0, lower = 0;

            for (int i = 0; i < str.Length; i++)
            {
                char ch = str[i];
                if (ch >= 'A' && ch <= 'Z')
                    upper++;
                else if (ch >= 'a' && ch <= 'z')
                    lower++;

            }
            if (lower >= upper)
            {
                Console.WriteLine(str.ToLower());
            }
            else
            {
                Console.WriteLine(str.ToUpper());
            }
        }

    }

}


using System;
using System.Linq;

namespace Minimum_Binary_Number
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string characters = Console.ReadLine();
            int zeroCount = characters.Count(x => x == '0');
            if (!characters.Contains('1')) Console.WriteLine(characters);
            else
            {
                Console.Write("1");
                for (int i = 0; i < zeroCount; i++) Console.Write("0");
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Threading;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public Scanner sc;
    public void Solve()
    {
        var N = sc.Int;
        var S = sc.Str.ToCharArray();
        if (N == 1) Fail(new string(S));
        var ct = 0;
        var res = new List<int>() { 1 };
        for (int i = 1; i < N; i++)
        {
            if (S[i] == '1') ct++;
        }
        for (int k = 0; k < N - 1 - ct; k++) res.Add(0);
        Console.WriteLine(string.Join("", res));
    }
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var sol = new Solver() { sc = new Scanner() };
        //var th = new Thread(sol.Solve, 1 << 26);th.Start();th.Join();
        sol.Solve();
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    public void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            List<long> nums = Console.ReadLine().Split(' ').Select(long.Parse).Distinct().ToList();
            int result = 0;
            while (nums.Count > 0)
            {
                long min = nums.Min();
                nums = nums.Where(n => n % min != 0).ToList();
                result++;
            }

            Console.WriteLine(result);
        }
    }
}


/*
csc -debug A.cs && mono --debug A.exe <<< "6
10 2 3 5 4 2"
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Reflection;

public class HelloWorld {
    public static void SolveCodeForces() {
        var n = cin.NI();
        var A = cin.NIA();

        var ans = 0;

        while (A.Length > 0) {
            ans++;
            var min = A.Min();
            A = A.Where(a => a % min != 0).ToArray();
        }

        System.Console.WriteLine(ans);
    }

    static Scanner cin = new Scanner();
    static StringBuilder cout = new StringBuilder();

    static public void Main () {
        SolveCodeForces();
        // IncreaseStack(SolveCodeForces);
        // System.Console.Write(cout.ToString());
    }

    public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)
    {
        var thread = new Thread(action, stackSize);
        thread.Start();
        thread.Join();
    }
}

public static class Helpers {
    public static string Join<T>(this IEnumerable<T> arr, string sep = " ") {
        return string.Join(sep, arr);
    }

    public static void Swap<T>(ref T a, ref T b) {
        var tmp = a;
        a = b;
        b = tmp;
    }

    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }
}

public class Scanner
{
    private string[] line = new string[0];
    private int index = 0;

    public string Next() {
        if (line.Length <= index) {
            line = Console.ReadLine().Split(' ');
            index = 0;
        }
        var res = line[index];
        index++;
        return res;
    }

    public int NI() {
        return int.Parse(Next());
    }

    public long NL() {
        return long.Parse(Next());
    }

    public ulong NUL() {
        return ulong.Parse(Next());
    }

    public string[] Array() {
        line = Console.ReadLine().Split(' ');
        index = line.Length;
        return line;
    }

    public int[] NIA(int emptyPrefixLen = 0) {
        var array = Array();
        var result = new int[emptyPrefixLen + array.Length];
        for (int i = 0; i < array.Length; i++)
            result[emptyPrefixLen + i] = int.Parse(array[i]);
        return result;
    }

    public long[] NLA() {
        var array = Array();
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = long.Parse(array[i]);
        return result;
    }

    public ulong[] NULA() {
        var array = Array();
        var result = new ulong[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = ulong.Parse(array[i]);
        return result;
    }
}