using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            // var line = consoleReader.SplitInt32();
            var N = consoleReader.Int64();
            if (N < 3) return 0;

            var factoring = new PrimeFactor().Enumerate(N).ToArray();
            var yakusu = new HashSet<long> { 1 };
            foreach (var f in factoring)
            {
                foreach (var y in yakusu.ToArray())
                {
                    yakusu.Add(y * f);
                }
            }

            long sum = 0;
            foreach (var y in yakusu.OrderBy(l => l))
            {
                var x = N / y - 1;
                if (x < 2)
                    break;
                if (x <= y)
                    continue;
                sum += x;
            }
            return sum;
        }

        // 参考 https://qiita.com/gushwell/items/561afde2e00bf3380c98
        public class PrimeFactor
        {

            public IEnumerable<long> Enumerate(long n)
            {
                while (n > 1)
                {
                    long factor = GetFactor(n);
                    yield return factor;
                    n = n / factor;
                }
            }

            private long GetFactor(long n, int seed = 1)
            {
                if (n % 2 == 0)
                    return 2;
                if (IsPrime(n))
                    return n;
                long x = 2;
                long y = 2;
                long d = 1;
                long count = 0;
                while (d == 1)
                {
                    count++;
                    x = f(x, n, seed);
                    y = f(f(y, n, seed), n, seed);
                    d = Gcd(Math.Abs(x - y), n);
                }
                if (d == n)
                    // 見つからなかった、乱数発生のシードを変えて再挑戦。
                    return GetFactor(n, seed + 1);
                // 素数でない可能性もあるので、再度呼び出す
                return GetFactor(d);
            }

            private int[] seeds = new int[] { 3, 5, 7, 11, 13, 17 };
            private long f(long x, long n, int seed)
            {
                return (seeds[seed % 6] * x + seed) % n;
            }

            private static long Gcd(long a, long b)
            {
                if (a < b)
                    return Gcd(b, a);  // 引数を入替えて自分を呼び出す
                if (b == 0)
                    return a;
                long d = 0;
                do
                {
                    d = a % b;
                    a = b;
                    b = d;
                } while (d != 0);
                return a;
            }

            // 効率は良くないが、これでも十分な速度がでたので、良しとする。
            private static bool IsPrime(long number)
            {
                long boundary = (long)Math.Floor(Math.Sqrt(number));

                if (number == 1)
                    return false;
                if (number == 2)
                    return true;

                for (long i = 2; i <= boundary; ++i)
                {
                    if (number % i == 0)
                        return false;
                }

                return true;
            }
        }


        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
        public static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
    }

    public class ConsoleReader
    {
        public virtual string String() => Console.ReadLine(); public int Int32() => int.Parse(String()); public long Int64() => long.Parse(String()); public ulong UInt64() => ulong.Parse(String()); public double Double() => double.Parse(String()); public string[] Split() => String().Split().ToArray(); public int[] SplitInt32() => String().Split().Select(int.Parse).ToArray(); public long[] SplitInt64() => String().Split().Select(long.Parse).ToArray(); public ulong[] SplitUInt64() => String().Split().Select(ulong.Parse).ToArray(); public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray(); public IEnumerable<string> Repeat(int count) { for (int i = 0; i < count; i++) yield return String(); }
        public IEnumerable<int> RepeatInt32(int count) { for (int i = 0; i < count; i++) yield return Int32(); }
        public IEnumerable<long> RepeatInt64(int count) { for (int i = 0; i < count; i++) yield return Int64(); }
        public IEnumerable<string[]> RepeatSplit(int count) { for (int i = 0; i < count; i++) yield return Split(); }
        public IEnumerable<int[]> RepeatSplitInt32(int count) { for (int i = 0; i < count; i++) yield return SplitInt32(); }
    }
}


Measured memory_bytes: 13524