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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int Gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }

    private const int SIEVE_SIZE = 1000010;
    private readonly bool[] isComposite = new bool[SIEVE_SIZE + 1];
    private readonly IList<int> primes = new List<int>();
    void Sieve()
    {
        for (int i = 2; i * i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                for (int j = i * i; j <= SIEVE_SIZE; j += i)
                    isComposite[j] = true;
        for (int i = 2; i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                primes.Add(i);
    }

    public void Solve()
    {
        Sieve();

        long a = ReadLong();
        if (a == 1)
        {
            Write(1);
            return;
        }
        var d = new SDictionary<long, int> { { a, 1 } };
        int ans = 0;
        var ts = DateTime.Now;
        for (int i = 0; i < primes.Count; i++)
        {
            bool ok = false;
            for (long x = primes[i]; !ok && x < a; x *= primes[i])
                if (a % (x + 1) == 0)
                    ok = true;
            if (!ok)
                continue;

            var toAdd = new List<Tuple<long, int>>();
            var toRemove = new List<long>();
            foreach (var p in d)
            {
                if (p.Key <= primes[i])
                    toRemove.Add(p.Key);
                for (long x = primes[i]; x < p.Key; x *= primes[i])
                    if (p.Key % (x + 1) == 0)
                    {
                        long y = p.Key / (x + 1);
                        if (y == 1)
                            ans += p.Value;
                        else if (y > primes[i] && y % 2 == 0)
                            toAdd.Add(Tuple.Create(y, p.Value));
                    }
            }
            foreach (int x in toRemove)
                d.Remove(x);
            foreach (var p in toAdd)
                d[p.Item1] += p.Item2;
        }
        //Write((DateTime.Now - ts).TotalMilliseconds);

        foreach (var p in d)
            if (p.Key > SIEVE_SIZE)
            {
                long x = p.Key - 1;
                bool ok = true;
                for (int i = 0; ok && 1L * primes[i] * primes[i] <= x; i++)
                    if (x % primes[i] == 0)
                        ok = false;
                if (ok)
                    ans += p.Value;
            }

        Write(ans);
    }

    #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("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
//            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
//            thread.Start();
//            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#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 ReadInt(){return int.Parse(ReadToken());}
    public static long ReadLong(){return long.Parse(ReadToken());}
    public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}
    public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}
    public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).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 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 WriteArray<T>(IEnumerable<T> array){writer.WriteLine(string.Join(" ", array));}
    public static void Write(params object[] array){WriteArray(array);}
    public static void WriteLines<T>(IEnumerable<T> array){foreach (var a in array)writer.WriteLine(a);}
    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
}

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

class ProblemD {
    static string inputFileName = "../../input.txt";
    static StreamReader fileReader;
    static string[] inputTokens;
    static int curInputTokenIndex;
    static string NextToken() {
        string ret = "";
        while (ret == "") {
            if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {
                string line;
                if (Type.GetType("HaitaoLocal") != null) {
                    if (fileReader == null) {
                        fileReader = new StreamReader(inputFileName);
                    }
                    line = fileReader.ReadLine();
                    if (line == null) {
                        throw new Exception("Error: out of input tokens!");
                    }
                } else {
                    line = Console.ReadLine();
                }
                inputTokens = line.Split();
                curInputTokenIndex = 0;
            }
            ret = inputTokens[curInputTokenIndex++];
        }
        return ret;
    }
    static int ReadInt() {
        return Int32.Parse(NextToken());
    }
    static string ReadString() {
        return NextToken();
    }
    static long ReadLong() {
        return Int64.Parse(NextToken());
    }
    static int[] ReadIntArray(int length) {
        int[] ret = new int[length];
        for (int i = 0; i < length; i++) {
            ret[i] = ReadInt();
        }
        return ret;
    }
    static string[] ReadStringArray(int length) {
        string[] ret = new string[length];
        for (int i = 0; i < length; i++) {
            ret[i] = ReadString();
        }
        return ret;
    }
    static long[] ReadLongArray(int length) {
        long[] ret = new long[length];
        for (int i = 0; i < length; i++) {
            ret[i] = ReadLong();
        }
        return ret;
    }
    static string DoubleToString(double d) {
        return d.ToString(new CultureInfo("en-US"));
    }

    public static void Main(string[] args) {
        int Q = 1000001;
        bool[] notPrime = new bool[Q];
        notPrime[0] = true;
        notPrime[1] = true;
        for (int i = 2; i <= Math.Sqrt(notPrime.Length); i++) {
            if (!notPrime[i]) {
                for (int j = i * 2; j < notPrime.Length; j += i) {
                    notPrime[j] = true;
                }
            }
        }
        List<int> primes = new List<int>();
        for(int i=0; i<Q; i++) if(!notPrime[i]) primes.Add(i);
        long N = ReadLong();
        List<long> factors = new List<long>();
        for (long i = 1; i <= 1000000; i++) {
            if (N % i != 0) continue;
            if (i * i > N) break;
            factors.Add(i);
            if(i*i!=N) factors.Add(N / i);
        }
        factors.Sort();
        Dictionary<long, long> pmap = new Dictionary<long, long>();
        foreach (long f in factors) {
            long k = f - 1;
            bool flag = true;
            foreach (int p in primes) {
                if (k % p == 0) {
                    flag = false;
                    long x = 1;
                    while (x < k) x *= p;
                    if (x == k) {
                        pmap.Add(f, p);
                    } else {
                        break;
                    }
                }
            }
            if (flag && k>1) pmap.Add(f, k);
        }
        //foreach (long key in pmap.Keys) {
        //    Console.WriteLine(key + " " + pmap[key]);
        //}
        Dictionary<long, long> dp = new Dictionary<long, long>();

        foreach (long i in factors) {
            dp[i] = 0;
        }
        dp[1] = 1;
        Dictionary<long,long> used = new Dictionary<long, long>();
        foreach (long key in pmap.Keys) {
            long p = pmap[key];
            if (used.ContainsKey(p)) continue;
            used.Add(p, 0);

            Dictionary<long, long> toAdd = new Dictionary<long, long>();
            foreach (long k2 in pmap.Keys) {
                if (pmap[k2] != p) continue;
                foreach (long f in factors) {
                    if(f%k2!=0) continue;
                    if (toAdd.ContainsKey(f)) toAdd[f] += dp[f / k2];
                    else toAdd[f] = dp[f / k2];
                }
            }
            foreach (long f in toAdd.Keys) {
                dp[f] += toAdd[f];
            }
        }

        //foreach (long key in factors) {
        //    Console.WriteLine(key + " " + dp[key]);
        //}

        Console.WriteLine(dp[N]);

    }
}

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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int Gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }

    private const int SIEVE_SIZE = 1000010;
    private readonly bool[] isComposite = new bool[SIEVE_SIZE + 1];
    private readonly IList<int> primes = new List<int>();
    void Sieve()
    {
        for (int i = 2; i * i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                for (int j = i * i; j <= SIEVE_SIZE; j += i)
                    isComposite[j] = true;
        for (int i = 2; i <= SIEVE_SIZE; i++)
            if (!isComposite[i])
                primes.Add(i);
    }

    Dictionary<Tuple<long, int>, int> mem = new Dictionary<Tuple<long, int>, int>();
    int Fun(long x, int y)
    {
        if (x == 1)
            return 1;
        var key = Tuple.Create(x, y);
        if (mem.ContainsKey(key))
        {
            Write("hit");
            return mem[key];
        }
        int ret = 0;
        for (int i = y; i < primes.Count && primes[i] < x; i++)
        {
            for (long j = primes[i]; j < x; j *= primes[i])
                if (x % (j + 1) == 0)
                    ret += Fun(x / (j + 1), i + 1);
        }

        return mem[key] = ret;
    }

    public void Solve()
    {
        Sieve();

        long a = ReadLong();
        var d = new SDictionary<long, int> { { a, 1 } };
        int ans = 0;
        for (int i = 0; i < primes.Count; i++)
        {
            var toAdd = new List<Tuple<long, int>>();
            var toRemove = new List<long>();
            foreach (var p in d)
            {
                if (p.Key <= primes[i])
                    toRemove.Add(p.Key);
                for (long x = primes[i]; x < p.Key; x *= primes[i])
                    if (p.Key % (x + 1) == 0)
                    {
                        long y = p.Key / (x + 1);
                        if (y == 1)
                            ans += p.Value;
                        else if (y > primes[i])
                            toAdd.Add(Tuple.Create(p.Key / (x + 1), p.Value));
                    }
            }
            foreach (var p in toAdd)
                d[p.Item1] += p.Item2;
            foreach (int x in toRemove)
                d.Remove(x);
        }

        foreach (var p in d)
            if (p.Key > SIEVE_SIZE)
            {
                long x = p.Key - 1;
                bool ok = true;
                for (int i = 0; ok && 1L * primes[i] * primes[i] <= x; i++)
                    if (x % primes[i] == 0)
                        ok = false;
                if (ok)
                    ans += p.Value;
            }

        Write(ans);
    }

    #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("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
//            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
//            thread.Start();
//            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#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 ReadInt(){return int.Parse(ReadToken());}
    public static long ReadLong(){return long.Parse(ReadToken());}
    public static double ReadDouble(){return double.Parse(ReadToken(), CultureInfo.InvariantCulture);}
    public static int[] ReadIntArray(){return ReadAndSplitLine().Select(int.Parse).ToArray();}
    public static long[] ReadLongArray(){return ReadAndSplitLine().Select(long.Parse).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 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 WriteArray<T>(IEnumerable<T> array){writer.WriteLine(string.Join(" ", array));}
    public static void Write(params object[] array){WriteArray(array);}
    public static void WriteLines<T>(IEnumerable<T> array){foreach (var a in array)writer.WriteLine(a);}
    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
}


using System;
using System.Linq;

namespace codefrocesglobalround3
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] info = Console.ReadLine().Split().Select(x => Convert.ToInt64(x)).ToArray();

            Console.WriteLine(2 * (info[2] + Math.Min(info[0], info[1])) + (Math.Max(info[0], info[1]) - Math.Min(info[0], info[1]) > 0 ? 1 : 0));
        }
    }
}

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

namespace ReadWriteTemplate
{
    public static class Solver
    {
        private static void SolveCase()
        {
            long a = ReadLong();
            long b = ReadLong();
            long c = ReadLong();

            long d = Math.Min(a, b);
            long ans = 2 * c + 2 * d;
            a -= d;
            b -= d;
            if (a > 0)
            {
                ans++;
            }
            if (b > 0)
            {
                ans++;
            }
            Writer.Write(ans);
        }

        public static void Solve()
        {
#if DEBUG
            var sw = Stopwatch.StartNew();
#endif

            SolveCase();

            /*int T = ReadInt();
            for (int i = 0; i < T; i++)
            {
                // Writer.Write("Case #{0}: ", i + 1);
                SolveCase();
            }*/

#if DEBUG
            sw.Stop();
            // Console.WriteLine($"{sw.ElapsedMilliseconds} ms");
#endif
        }

        public static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if DEBUG
            // Reader = Console.In; Writer = Console.Out;
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");
#else
            Reader = Console.In; Writer = Console.Out;
#endif

            // Solve();
            Thread thread = new Thread(Solve, 64 * 1024 * 1024);
            thread.CurrentCulture = CultureInfo.InvariantCulture;
            thread.Start();
            thread.Join();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Shuffle(result);
            return result;
        }

        private static void Shuffle<T>(IList<T> array)
        {
            Random rnd = new Random();
            for (int i = array.Count - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = array[k];
                array[k] = array[i];
                array[i] = tmp;
            }
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        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 string ReadLine()
        {
            return Reader.ReadLine();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).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 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 WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {

        static void Main(string[] args)
        {
            int[] count = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long rez = count[2] * 2;
            rez += (count[0] == count[1]) ? count[0] * 2 : Math.Min(count[0], count[1]) * 2+1;
            Console.WriteLine(rez); ;

        }
    }
}

using System;

namespace CSharp
{
    class _1148A
    {
        public static void Main()
        {
            var tokens = Console.ReadLine().Split();

            uint a = uint.Parse(tokens[0]);
            uint b = uint.Parse(tokens[1]);
            uint c = uint.Parse(tokens[2]);

            Console.WriteLine(2 * Math.Min(a, b) + 2 * c + Math.Sign(Math.Max(a, b) - Math.Min(a, b)));
        }
    }
}

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

namespace Solution
{
    class Program
    {
        static void Main(string[] args)
        {
            var nums = Console.ReadLine().Split().Select(x => long.Parse(x)).ToList();
            long min = Math.Min(nums[0], nums[1]);
            long res = 2 * nums[2] + 2 * min + (nums[0] - min > 0 ? 1 : 0) + (nums[1] - min > 0 ? 1 : 0);
            Console.WriteLine(res);
        }
    }
}

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

namespace Problems
{
    class Problems
    {

        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split(' ');
            long a = Convert.ToInt32(line[0]);
            long b = Convert.ToInt32(line[1]);
            long c = Convert.ToInt32(line[2]);
            int add = 0;
            if (a != b)
            {
                add = 1;
            }
            Console.WriteLine(Math.Min(a, b) * 2 + c * 2 + add);
        }
    }
}

using System;
using System.Globalization;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    public void Solve()
    {
      var a = input.ReadLong();
      var b = input.ReadLong();
      var c = input.ReadLong();
      if (a > b)
        Write(2 * Min(a, b) + 1 + 2 * c);
      else if (a < b)
        Write(1 + 2 * c + 2 * Min(a, b));
      else
        Write(a + b + 2 * c);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public string ReadToEnd()
    {
      return this.reader.ReadToEnd();
    }

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      var result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(this.ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      var c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}

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

namespace ConsoleApplication1
{
    class A1148_AnotherOneBitesTheDust
    {
        public static void Main()
        {
            string[] x = Console.ReadLine().Split(' ');
            int a = int.Parse(x[0]);
            int b = int.Parse(x[1]);
            int c = int.Parse(x[2]);
            decimal sum = 0;
            if(a==b)
            {
                sum += (a + b);
                sum += 2 * c;
                Console.WriteLine(sum);
            }else
            {
                if (a > b)
                {
                    sum = b;
                }else
                {
                    sum = a;
                }
                sum += sum;
                sum += 1;
                sum += 2 * c;
                Console.WriteLine(sum);
            }
        }
    }
}

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

namespace ForAcm
{
	class MainClass
	{
		static int t;
		static string s;
		static string[] ss;
		public static void Main (string[] args)
		{
//			s = Console.ReadLine ();
//			t = int.Parse (s);
//			for (int i = 1; i <= t; i++) {
				//Console.WriteLine ("Case #%d: ", i);
				doit ();
//			}
		}

		private static void doit(){
			s = Console.ReadLine ();
			ss = s.Split (' ');
			int a, b, c;
			a = int.Parse (ss[0]);
			b = int.Parse (ss[1]);
			c = int.Parse (ss[2]);
			long ans = c * 2;
			if (a > b) {
				ans = ans + b * 2 + 1;
			} else if (a < b) {
				ans = ans + a * 2 + 1;
			} else {
				ans = ans + a + b;
			}
			Console.WriteLine (ans);
		}
	}

}

using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long A = long.Parse(str[0]);
		long B = long.Parse(str[1]);
		long C = long.Parse(str[2]);
		long ans = C*2+Math.Min(A,B)*2;
		if(A>B){
			ans += 1;
		}
		long ans2 = 0;
		if(B>0){
			ans2 = 1;
		}
		ans2 += C*2+Math.Min(A,B-1)*2;
		if(A>B-1){
			ans2 += 1;
		}
		ans = Math.Max(ans,ans2);
		Console.WriteLine(ans);
	}
}

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

namespace Problem{

    public class Solution{

        public static void Main(){

            int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int a = nums[0];
            int b = nums[1];
            int c = nums[2];

            long totalLength = (long)c*2;

            if(a > b){
                totalLength += (long)2*b + 1;
            }else if(a < b){
                totalLength += (long)2*a + 1;
            }else{
                totalLength += (long)2*b;
            }

            Console.WriteLine(totalLength);
        }
    }
}

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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

          string[]y=Console.ReadLine().Split(' ');
          Int64 a=Int64.Parse(y[0]);
          Int64 b=Int64.Parse(y[1]);
          Int64 c=Int64.Parse(y[2]);
          Int64 d=Math.Min(a,b);
          Int64 o=d;
          if(a!=b)
          o++;
          Console.WriteLine(d+o+c*2);
        }
    }
}

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

namespace Another_One_Bites_The_Dust
{
    class Program
    {
        static void Main(string[] args)
        {
            long answer = 0;

            String[] vs = Console.ReadLine().Split(' ');
            long a = Convert.ToInt32(vs[0]);
            long b = Convert.ToInt32(vs[1]);
            long c = Convert.ToInt32(vs[2]);

            answer = c * 2;

            answer += Math.Min(a, b) * 2;

            if (a != b)
                answer++;

            Console.WriteLine(answer);
        }
    }
}

using System;

namespace leetcode
{
    class Program
    {

        static void Main(string[] args)
        {

            long n1, n2, n3;

            string[] ns = Console.ReadLine().Split();

            n1 = long.Parse(ns[0]);
            n2 = long.Parse(ns[1]);
            n3 = long.Parse(ns[2]);

            long m = 2 * n3;

            if(n1 > n2)
            {
                m += n2 + n2 + 1;
            }
            else if(n2 > n1)
            {
                m += n1 + n1 + 1;
            }
            else
            {
                m += n1 + n2;
            }

            Console.WriteLine(m);
        }

    }
}

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

namespace Pustoi
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] s = str.Split(' ');
            long a = Convert.ToInt64(s[0]);
            long b = Convert.ToInt64(s[1]);
            long c = Convert.ToInt64(s[2]);
            if (a > b)
            {
                Console.WriteLine(a-(a-b-1)+b+2*c);
            }
            else if (a < b)
            {
                Console.WriteLine(b - (b - a - 1) + a + 2 * c);
            }
            else
            {
                Console.WriteLine(b + a + 2 * c);
            }

            Console.Read();
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Another_One_Bites_The_Dust
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static long Solve(string[] args)
        {
            long a = Next();
            long b = Next();
            long c = Next();

            long ans = 2*c;

            if (a == b)
            {
                ans += 2*a;
            }
            else
            {
                ans += 2*Math.Min(a, b) + 1;
            }

            return ans;
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var abc = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Console.WriteLine((abc[0] != abc[1] ? 1 : 0) + Min(abc[0], abc[1]) * 2 + abc[2] * 2);
    }
}

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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){

		if(A == B){
			Console.WriteLine(A + B + 2 * AB);
			return;
		}

		if(A < B){
			var t = A; A = B; B = t;
		}

		long ans = 2 * AB + B * 2;
		Console.WriteLine(ans + 1);

	}
	long A,B,AB;
	public Sol(){
		var d = ria();
		A = d[0]; B = d[1]; AB = d[2];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

/*
csc -debug A.cs && mono --debug A.exe <<< "1 1 1"
*/

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

public class HelloWorld {
    public static void SolveCodeForces() {
        var a = cin.NextLong();
        var b = cin.NextLong();
        var c = cin.NextLong();
        System.Console.WriteLine(2L*(c + Math.Min(a, b)) + (a == b ? 0L : 1L));
    }

    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 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 NextInt() {
        return int.Parse(Next());
    }

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

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

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

    public int[] IntArray(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[] LongArray() {
        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[] UlongArray() {
        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;
    }
}

using System;

class Program
{
    static void Main()
    {
        int[] arr = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

        long k = (long)arr[2] * 2 + Math.Min(arr[0], arr[1]) * 2 + (Math.Abs(arr[0] - arr[1]) > 0 ? 1 : 0);

        Console.WriteLine(k);
    }
}

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

namespace algorithms_700_01
{
    class Program
    {
        static void Main()
        {
            var array = Console.ReadLine().Split(new char[] { ' ' }).Select(x => long.Parse(x)).ToArray();
            var maxStringLength = 2 * array[2] + 2 * Math.Min(array[0], array[1]) + (array[0] == array[1] ? 0 : 1);
            Console.WriteLine(maxStringLength);
        }
    }
}

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

namespace ConsoleApp34
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] n = Console.ReadLine().Trim().Split().Select(x=> long.Parse(x)).ToArray();
            if(Math.Abs(n[0]-n[1])<=1)
                Console.WriteLine(n[0] + n[1] + n[2] * 2);
            else
                Console.WriteLine((n[0] + n[1] + n[2] * 2)- Math.Abs(n[0] - n[1])+1);
        }
    }
}

using System;
using System.Numerics;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var abc = Console.ReadLine();
            var a = BigInteger.Parse(abc.Split()[0]);
            var b = BigInteger.Parse(abc.Split()[1]);
            var c = BigInteger.Parse(abc.Split()[2]);

            var max = c * 2;

            if (a < b)
            {
                max += a * 2 + 1;
            }
            else if (a == b)
            {
                max += a * 2;
            }
            else
            {
                max += b * 2 + 1;
            }

            Console.WriteLine(max);

            //Console.ReadKey();
        }
    }
}

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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        long a, b, c;
        a = cin.nextInt();
        b = cin.nextInt();
        c = cin.nextInt();

        a = Math.Min(a, b + 1);
        b = Math.Min(b, a + 1);
        Console.WriteLine(a + b + c * 2);
    }

}

class Scanner
{
    string[] s;
    int i;

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

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

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

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

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

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class XRand
{
    uint x, y, z, w;

    public XRand()
    {
        init();
    }

    public XRand(uint s)
    {
        init();
        init_xor128(s);
    }

    void init()
    {
        x = 314159265; y = 358979323; z = 846264338; w = 327950288;

    }

    public void init_xor128(uint s)
    {
        z ^= s;
        z ^= z >> 21; z ^= z << 35; z ^= z >> 4;
        z *= 736338717;
    }

    uint next()
    {
        uint t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8;
    }

    public long nextLong(long m)
    {
        return (long)((((ulong)next() << 32) + next()) % (ulong)m);
    }

    public int nextInt(int m)
    {
        return (int)(next() % m);
    }

    public int nextIntP(int a)
    {
        return (int)Math.Pow(a, nextDouble());
    }

    public int nextInt(int min, int max)
    {
        return min + nextInt(max - min + 1);
    }

    public double nextDouble()
    {
        return (double)next() / uint.MaxValue;
    }

    public double nextDoubleP(double a)
    {
        return Math.Pow(a, nextDouble());
    }
}

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

namespace ProjectContest
{
    class Test
    {
        static void Main()
        {
            var abc = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            int a = abc[0], b = abc[1], c = abc[2];
            long kq = 2 * c;
            if (a == b) Console.WriteLine(kq + a + b);
            else Console.WriteLine(kq + 2*Math.Min(a, b)+1);

        }
    }
}

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

public class Class2
{
    static void Main()
    {
        string str;
        while ((str = Console.ReadLine()) != null)
        {
            var res = Func(str);
            Console.WriteLine(res);
        }
    }
    static long Func(string str)
    {
        var a = str.Split().Select(x => long.Parse(x)).ToArray();
        return Math.Min(a[0], a[1]) * 2 + a[2] * 2 + (Math.Abs(a[0] - a[1]) > 0 ? 1 : 0);
    }
}

using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
           long a = Convert.ToInt64(s[0]);
           long b = Convert.ToInt64(s[1]);
           long c = Convert.ToInt64(s[2]);
           long temp=c*2;
           if (a>=b) {temp+=b*2;}
           else {temp+=a*2;}
           if (a>b) temp++;
           if (b>a) temp++;
           Console.WriteLine(temp);
        }
    }
}

// Problem: 1148A - Another One Bites The Dust
// Author: Gusztav Szmolik

using System;

class AnotherOneBitesTheDust
    {
    public static int Main ()
        {
        string line = Console.ReadLine ();
        if (line == null)
            return -1;
        char[] delims = new char[] {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 3)
            return -1;
        uint a;
        if (!UInt32.TryParse (words[0], out a))
            return -1;
        if (a < 1 || a > 1000000000)
            return -1;
        uint b;
        if (!UInt32.TryParse (words[1], out b))
            return -1;
        if (b < 1 || b > 1000000000)
            return -1;
        uint c;
        if (!UInt32.TryParse (words[2], out c))
            return -1;
        if (c < 1 || c > 1000000000)
            return -1;
        uint countAB = c + Math.Min (a,b);
        uint ans = 2*countAB;
        if (a != b)
            ans++;
        Console.WriteLine (ans);
        return 0;
        }
    }

using System;

static class Program
{
    static void Main()
    {
        long[] array = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
        long sum = Math.Min(array[0], array[1]) * 2 + array[2] * 2;
        Console.WriteLine(array[0] == array[1] ? sum : sum + 1);
    }
}

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

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			//string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();

			long a = inputs1[0];
			long b = inputs1[1];
			long ab = inputs1[2];

			long length = 0;
			if (a > b)
			{
				length = 2 * ab + b + b + 1;
			}
			else if(a < b)
			{
				length = 2 * ab + a + a + 1;
			}
			else
			{
				length = 2 * ab + a + b;
			}

			Console.WriteLine(length);
		}

		public class Node
		{
			public int Count { get; set; }

			public int FirstIndex { get; set; } = -1;

			public int LastIndex { get; set; } = -1;
		}

		//public class Node<T>
		//{
		//	public Node<T> Left { get; set; }

		//	public Node<T> Right { get; set; }

		//	public T Value { get; set; }

		//	public Node(T value)
		//	{
		//		Value = value;
		//	}
		//}

		//public class Tree<T>
		//{
		//	public Node<T> Root { get; set; }

		//	public Tree(T value)
		//	{
		//		Root = new Node<T>(value);
		//	}
		//}

		private static long GCD(long a, long b)
		{
			long max = Math.Max(a, b);
			long min = Math.Min(a, b);

			if (min == 0)
			{
				return max;
			}

			a = min;
			b = max % min;
			return GCD(a, b);
		}

		//private static long LCM(long a, long b)
		//{
		//	return Math.Abs(a * b) / GCD(a, b);
		//}

		//private static int Length(short[] a)
		//{
		//	int firstItemIndex = 0;
		//	for (int i = 0; i < a.Length; i++)
		//	{
		//		if (a[i] == 0)
		//		{
		//			continue;
		//		}

		//		firstItemIndex = i;
		//		break;
		//	}

		//	return a.Length - firstItemIndex;
		//}

		//private static short[] Subtract(short[] a, short[] b)
		//{
		//	if (a.Length != b.Length)
		//	{
		//		throw new ArgumentException();
		//	}

		//	short[] result = new short[a.Length];
		//	Array.Copy(a, result, a.Length);
		//	for (int i = result.Length - 1; i >= 0; i--)
		//	{
		//		if (result[i] < b[i])
		//		{
		//			int j = i - 1;
		//			while (result[j] == 0)
		//			{
		//				result[j--] = 9;
		//			}

		//			result[j]--;
		//			result[i] += 10;
		//		}

		//		result[i] -= b[i];
		//	}

		//	return result;
		//}

		//private static short[] Multiply(short[] a, int b)
		//{
		//	short[] result = new short[a.Length];
		//	for (int i = a.Length - 1; i > 0; i--)
		//	{
		//		int temp = a[i] * b;
		//		result[i] = (short)(result[i] + temp % 10);
		//		result[i - 1] = (short)(result[i - 1] + temp / 10);
		//	}

		//	return result;
		//}

		//private static int Mod(short[] a, int b)
		//{
		//	int rest = 0, i = 0;
		//	while (i < a.Length)
		//	{
		//		int d = 10 * rest + a[i];
		//		while (d < b && i < a.Length - 1)
		//		{
		//			d = 10 * d + a[++i];
		//		}

		//		rest = d % b;
		//		i++;
		//	}

		//	return rest;
		//}

		//private static short[] Divide(short[] a, int b)
		//{
		//	short[] result = new short[a.Length];
		//	int rest = 0, i = 0;
		//	while (i < a.Length)
		//	{
		//		int d = 10 * rest + a[i];
		//		while (d < b && i < a.Length - 1)
		//		{
		//			d = 10 * d + a[++i];
		//		}

		//		result[i] = (short)(d / b);
		//		rest = d % b;
		//		i++;
		//	}

		//	return result;
		//}
	}
}

/*

   a b ab

   b ab a

   3 5 2

   1 3 0  8
   b 1 2 0  9
   ba 0 2 0 10
   bab 0 1 0 11

   3 1 3
   2 0 2  4
   a a ab ab  4

 */
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;

public class Solver
{
    public void Solve()
    {
        int a = ReadInt();
        int b = ReadInt();
        int c = ReadInt();
        long ans = c*2;
        ans += Math.Min(a, b) + Math.Min(Math.Max(a, b), Math.Min(a, b) + 1);
        Write(ans);
        return;
        int[] types = ReadIntArray();

        string[] tvalues = new string[] {"a", "b", "ab"};
        int min = types.Min();
        long count = (long)min * 4;
        types[0] -= min;
        types[1] -= min;
        types[2] -= min;

        int mi = -1;
        while (types.Max() > 0)
        {
            int next = -1;
            for (int i = 0; i < types.Length; i++)
            {
                bool isValid = mi == -1 || tvalues[i].Last() != tvalues[mi].Last();
                bool isMax = types[i] > 0 && (next == -1 || types[next] < types[i]);
                if (isValid && isMax)
                    next = i;
            }
            if (next == -1)
                break;
            mi = next;
            Debug.WriteLine(mi);
            types[mi]--;
            count += mi == 2 ? 2 : 1;
        }
        Write(count);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
        Debug.Listeners.Clear();
        Debug.Listeners.Add(new ConsoleTraceListener());
        Trace.Listeners.Clear();
        Trace.Listeners.Add(new ConsoleTraceListener());

        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        new Solver().Solve();
        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 ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).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 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 WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    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
}

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

namespace CodeForces
{
	class Program
	{
		static void Main(string[] args)
		{
			var (a, b, c) = Long3();
			var diff = Math.Abs(b - a);
			Console.WriteLine(2*c + 2*Math.Min(a,  b) + (diff > 0 ? 1 : 0));
		}

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

		static (int, int) Int2()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
			return (arr[0], arr[1]);
		}

		static (int, int, int) Int3()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
			return (arr[0], arr[1], arr[3]);
		}

		static int[] Ints()
		{
			return Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
		}

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

		static (long, long) Long2()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
			return (arr[0], arr[1]);
		}

		static (long, long, long) Long3()
		{
			var arr = Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
			return (arr[0], arr[1], arr[2]);
		}

		static long[] Longs()
		{
			return Array.ConvertAll(Console.ReadLine().Split(), Int64.Parse);
		}

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

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

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

namespace Problem{

    public class Solution{

        public static void Main(){

            int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int a = nums[0];
            int b = nums[1];
            int c = nums[2];

            int totalLength = c*2;

            if(a > b){
                totalLength += 2*b + 1;
            }else if(a < b){
                totalLength += 2*a + 1;
            }else{
                totalLength += 2*b;
            }

            Console.WriteLine(totalLength);
        }
    }
}

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

namespace Another_One_Bites_The_Dust
{
    class Program
    {
        static void Main(string[] args)
        {
            int answer = 0;

            String[] vs = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(vs[0]);
            int b = Convert.ToInt32(vs[1]);
            int c = Convert.ToInt32(vs[2]);

            answer = c * 2;

            answer += Math.Min(a, b) * 2;

            if (a != b)
                answer++;

            Console.WriteLine(answer);
        }
    }
}

using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        var abc = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Console.WriteLine(Min(abc[0], abc[1]) * 2 + abc[2] * 2);
    }
}

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

namespace ConsoleApp34
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] n = Console.ReadLine().Trim().Split().Select(x=> long.Parse(x)).ToArray();
            if(Math.Abs(n[0]-n[1])<=1)
                Console.WriteLine(n[0] + n[1] + n[2] * 2);
            else
                Console.WriteLine(n[0]-1 + n[1] + n[2] * 2);
        }
    }
}

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

namespace ConsoleApp34
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Trim().Split().Select(x=> int.Parse(x)).ToArray();
            Console.WriteLine(n[0] + n[1] + n[2] * 2);
        }
    }
}

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

namespace ConsoleApp34
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Trim().Split().Select(x=> int.Parse(x)).ToArray();
            if(Math.Abs(n[0]-n[1])<=1)
                Console.WriteLine(n[0] + n[1] + n[2] * 2);
            else
                Console.WriteLine(n[0]-1 + n[1] + n[2] * 2);
        }
    }
}

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

namespace ProjectContest
{
    class Test
    {
        static void Main()
        {
            var abc = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            int a = abc[0], b = abc[1], c = abc[2];
            int kq = 2 * c;
            if (a == b) Console.WriteLine(kq + a + b);
            else Console.WriteLine(kq + 2*Math.Min(a, b)+1);

        }
    }
}

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

namespace ProjectContest
{
    class Test
    {
        static void Main()
        {
            var abc = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            int a = abc[0], b = abc[1], c = abc[2];
            int kq = 2 * c;
            if (a == b) Console.WriteLine(kq + a + b);
            else Console.WriteLine(kq + Math.Min(a, b));

        }
    }
}

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

public class Class2
{
    static void Main()
    {
        string str;
        while ((str = Console.ReadLine()) != null)
        {
            var res = Func(str);
            Console.WriteLine(res);
        }
    }
    static int Func(string str)
    {
        var a = str.Split().Select(x => int.Parse(x)).ToArray();
        return Math.Min(a[0], a[1]) * 2 + a[2] * 2 + (Math.Abs(a[0] - a[1]) > 0 ? 1 : 0);
    }
}

using System;

static class Program
{
    static void Main()
    {
        int[] array = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        long sum = Math.Min(array[0], array[1]) * 2 + array[2] * 2;
        Console.WriteLine(array[0] == array[1] ? sum : sum + 1);
    }
}

/*

   a b ab

   b ab a

   3 5 2

   1 3 0  8
   b 1 2 0  9
   ba 0 2 0 10
   bab 0 1 0 11

 */
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Diagnostics;

public class Solver
{
    public void Solve()
    {
        int[] types = ReadIntArray();
        string[] tvalues = new string[] {"a", "b", "ab"};
        int min = types.Min();
        long count = (long)min * 4;
        types[0] -= min;
        types[1] -= min;
        types[2] -= min;

        int mi = -1;
        while (types.Max() > 0)
        {
            int next = -1;
            for (int i = 0; i < types.Length; i++)
            {
                bool isValid = mi == -1 || tvalues[i].Last() != tvalues[mi].Last();
                bool isMax = types[i] > 0 && (next == -1 || types[next] < types[i]);
                if (isValid && isMax)
                    next = i;
            }
            if (next == -1)
                break;
            mi = next;
            types[mi]--;
            count += mi == 2 ? 2 : 1;
        }
        Write(count);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
        Debug.Listeners.Clear();
        Debug.Listeners.Add(new ConsoleTraceListener());
        Trace.Listeners.Clear();
        Trace.Listeners.Add(new ConsoleTraceListener());

        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        new Solver().Solve();
        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 ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).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 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 WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    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
}