Way to go! Heidi now knows how many brains there must be for her to get one. But throwing herself in the midst of a clutch of hungry zombies is quite a risky endeavor. Hence Heidi wonders: what is the smallest number of brains that must be in the chest for her to get out at all (possibly empty-handed, but alive)?The brain dinner night will evolve just as in the previous subtask: the same crowd is present, the N - 1 zombies have the exact same mindset as before and Heidi is to make the first proposal, which must be accepted by at least half of the attendees for her to survive.

The only line of input contains one integer: N, the number of attendees (1 ≤ N ≤ 109).

Output one integer: the smallest number of brains in the chest which allows Heidi to merely survive.

// using a C# contest template, relevant code is at the bottom in the Run() function

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

class ProblemA {
    static string inputFileName = "../../input.txt";
    static StreamReader fileReader;
    static string[] inputTokens;
    static int curInputTokenIndex;
    static bool isLocal = Type.GetType("HaitaoLocal") != null;
    static string NextToken() {
        string ret = "";
        while (ret == "") {
            if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {
                string line;
                if (isLocal) {
                    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 ri { get { return RI(); } }
    static string rs { get { return RS(); } }
    static long rl { get { return RL(); } }
    static double rd { get { return RD(); } }
    static int RI() {
        return Int32.Parse(NextToken());
    }
    static string RS() {
        return NextToken();
    }
    static long RL() {
        return Int64.Parse(NextToken());
    }
    static double RD() {
        return Double.Parse(NextToken());
    }
    static int[] RIA(int length) {
        int[] ret = new int[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RI();
        }
        return ret;
    }
    static string[] RSA(int length) {
        string[] ret = new string[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RS();
        }
        return ret;
    }
    static long[] RLA(int length) {
        long[] ret = new long[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RL();
        }
        return ret;
    }
    static double[] RDA(int length) {
        double[] ret = new double[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RD();
        }
        return ret;
    }
    static StringBuilder outputBuilder;
    static CultureInfo outputCulture = new CultureInfo("en-US");
    static void Out(object obj) {
        Type type = obj.GetType();
        string str = obj.ToString();
        if (type == typeof(double) || type == typeof(float)) {
            str = ((double)obj).ToString(outputCulture);
        }
        outputBuilder.Append(str + " ");
    }
    static void Outl() {
        Outl("");
    }
    static void Outl(object obj) {
        Out(obj);
        outputBuilder.Append("\n");
    }
    static void Flush() {
        if (isLocal) {
            ConsoleColor t = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine();
            Console.WriteLine(outputBuilder.ToString());
            Console.ForegroundColor = t;
        } else {
            Console.WriteLine(outputBuilder.ToString());
        }
        outputBuilder = new StringBuilder();
    }
    static void Log(string label, object obj) {
        if (!isLocal) return;

        ConsoleColor t = Console.ForegroundColor;
        Console.ForegroundColor = ConsoleColor.Gray;
        Console.Write(label + ": ");
        Console.ForegroundColor = t;
        Log(obj);
    }
    static void Log(object obj) {
        if (!isLocal) return;

        ConsoleColor t = Console.ForegroundColor;
        Console.ForegroundColor = ConsoleColor.White;
        Console.WriteLine(ToStringRecursive(obj));
        Console.ForegroundColor = t;
    }
    static string ToStringRecursive(object obj) {
        StringBuilder sb = new StringBuilder();
        if (!(obj is string) && (obj is System.Collections.IEnumerable)) {
            System.Collections.IEnumerable en = obj as System.Collections.IEnumerable;
            sb.Append("{");
            bool first = true;
            foreach (object el in en) {
                if (!first) sb.Append(", ");
                sb.Append(ToStringRecursive(el));
                first = false;
            }
            sb.Append("}");
            return sb.ToString();
        }
        return obj.ToString();
    }

    public static void Main(string[] args) {
        long startTick = 0;
        if (isLocal) {
            startTick = Environment.TickCount;
            fileReader = new StreamReader(inputFileName);
        }

        outputBuilder = new StringBuilder();
        Run();
        if (isLocal) {
            ConsoleColor t = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine();
            Console.WriteLine(outputBuilder.ToString());
            Console.WriteLine();
            Console.ForegroundColor = t;
        } else {
            Console.WriteLine(outputBuilder.ToString());
        }

        if (isLocal) {
            long runTime = Environment.TickCount - startTick;
            if (runTime > 32) {
                Log("time", runTime);
                Log("");
            }
        }
    }

    static void Run() {
        int N = ri;
        int ans = 0;
        if (N % 2 == 1) ans = N / 2;
        else if (N > 2) {
            int p = 2;
            while (p * 2 <= N) p *= 2;
            ans = (N - p) / 2;
        }
        Outl(ans);
    }
}

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

namespace Collective_Mindsets__easy_
{
    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)
        {
            int n = int.Parse(reader.ReadLine());

            writer.WriteLine(n%2 == 0 ? Calc(n) : (n - 1)/2);
            writer.Flush();
        }

        private static int Calc(int n)
        {
            int k = 1;
            while (2*k <= n)
            {
                k <<= 1;
            }
            return (n - k)/2;
        }
    }
}

// using a C# contest template, relevant code is at the bottom in the Run() function

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

class ProblemA {
    static string inputFileName = "../../input.txt";
    static StreamReader fileReader;
    static string[] inputTokens;
    static int curInputTokenIndex;
    static bool isLocal = Type.GetType("HaitaoLocal") != null;
    static string NextToken() {
        string ret = "";
        while (ret == "") {
            if (inputTokens == null || curInputTokenIndex >= inputTokens.Length) {
                string line;
                if (isLocal) {
                    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 ri { get { return RI(); } }
    static string rs { get { return RS(); } }
    static long rl { get { return RL(); } }
    static double rd { get { return RD(); } }
    static int RI() {
        return Int32.Parse(NextToken());
    }
    static string RS() {
        return NextToken();
    }
    static long RL() {
        return Int64.Parse(NextToken());
    }
    static double RD() {
        return Double.Parse(NextToken());
    }
    static int[] RIA(int length) {
        int[] ret = new int[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RI();
        }
        return ret;
    }
    static string[] RSA(int length) {
        string[] ret = new string[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RS();
        }
        return ret;
    }
    static long[] RLA(int length) {
        long[] ret = new long[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RL();
        }
        return ret;
    }
    static double[] RDA(int length) {
        double[] ret = new double[length];
        for (int i = 0; i < length; i++) {
            ret[i] = RD();
        }
        return ret;
    }
    static StringBuilder outputBuilder;
    static CultureInfo outputCulture = new CultureInfo("en-US");
    static void Out(object obj) {
        Type type = obj.GetType();
        string str = obj.ToString();
        if (type == typeof(double) || type == typeof(float)) {
            str = ((double)obj).ToString(outputCulture);
        }
        outputBuilder.Append(str + " ");
    }
    static void Outl() {
        Outl("");
    }
    static void Outl(object obj) {
        Out(obj);
        outputBuilder.Append("\n");
    }
    static void Flush() {
        if (isLocal) {
            ConsoleColor t = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine();
            Console.WriteLine(outputBuilder.ToString());
            Console.ForegroundColor = t;
        } else {
            Console.WriteLine(outputBuilder.ToString());
        }
        outputBuilder = new StringBuilder();
    }
    static void Log(string label, object obj) {
        if (!isLocal) return;

        ConsoleColor t = Console.ForegroundColor;
        Console.ForegroundColor = ConsoleColor.Gray;
        Console.Write(label + ": ");
        Console.ForegroundColor = t;
        Log(obj);
    }
    static void Log(object obj) {
        if (!isLocal) return;

        ConsoleColor t = Console.ForegroundColor;
        Console.ForegroundColor = ConsoleColor.White;
        Console.WriteLine(ToStringRecursive(obj));
        Console.ForegroundColor = t;
    }
    static string ToStringRecursive(object obj) {
        StringBuilder sb = new StringBuilder();
        if (!(obj is string) && (obj is System.Collections.IEnumerable)) {
            System.Collections.IEnumerable en = obj as System.Collections.IEnumerable;
            sb.Append("{");
            bool first = true;
            foreach (object el in en) {
                if (!first) sb.Append(", ");
                sb.Append(ToStringRecursive(el));
                first = false;
            }
            sb.Append("}");
            return sb.ToString();
        }
        return obj.ToString();
    }

    public static void Main(string[] args) {
        long startTick = 0;
        if (isLocal) {
            startTick = Environment.TickCount;
            fileReader = new StreamReader(inputFileName);
        }

        outputBuilder = new StringBuilder();
        Run();
        if (isLocal) {
            ConsoleColor t = Console.ForegroundColor;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine();
            Console.WriteLine(outputBuilder.ToString());
            Console.WriteLine();
            Console.ForegroundColor = t;
        } else {
            Console.WriteLine(outputBuilder.ToString());
        }

        if (isLocal) {
            long runTime = Environment.TickCount - startTick;
            if (runTime > 32) {
                Log("time", runTime);
                Log("");
            }
        }
    }

    static void Run() {
        int N = ri;
        int ans = 0;
        if (N % 2 == 1) ans = N / 2;
        else if (N > 2) {
            int p = 2;
            while (p * 2 < N) p *= 2;
            ans = (N - p) / 2;
        }
        Outl(ans);
    }
}

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

namespace Collective_Mindsets__easy_
{
    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)
        {
            int n = int.Parse(reader.ReadLine());

            writer.WriteLine((n + 1)/2 - 1);
            writer.Flush();
        }
    }
}

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

namespace Collective_Mindsets__easy_
{
    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)
        {
            int n = int.Parse(reader.ReadLine());

            writer.WriteLine(n%2 == 0 ? 0 : (n + 1)/2 - 1);
            writer.Flush();
        }
    }
}