You have a rectangular board of size $$$n\times m$$$ ($$$n$$$ rows, $$$m$$$ columns). The $$$n$$$ rows are numbered from $$$1$$$ to $$$n$$$ from top to bottom, and the $$$m$$$ columns are numbered from $$$1$$$ to $$$m$$$ from left to right. The cell at the intersection of row $$$i$$$ and column $$$j$$$ contains the number $$$i^j$$$ ($$$i$$$ raised to the power of $$$j$$$). For example, if $$$n=3$$$ and $$$m=3$$$ the board is as follows:  Find the number of distinct integers written on the board.

The only line contains two integers $$$n$$$ and $$$m$$$ ($$$1\le n,m\le 10^6$$$) — the number of rows and columns of the board.

Print one integer, the number of distinct integers on the board.

NoteThe statement shows the board for the first test case. In this case there are $$$7$$$ distinct integers: $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$8$$$, $$$9$$$, and $$$27$$$.In the second test case, the board is as follows:  There are $$$5$$$ distinct numbers: $$$1$$$, $$$2$$$, $$$4$$$, $$$8$$$ and $$$16$$$.In the third test case, the board is as follows:  There are $$$6$$$ distinct numbers: $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$, $$$9$$$ and $$$16$$$.

using System.Xml;
using System.ComponentModel.Design;
using System.Security.AccessControl;
using System.Globalization;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

namespace CodeForce
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ');
            var rows = Int32.Parse(arr[0]);
            var cols = Int32.Parse(arr[1]);
            Console.WriteLine(GetCount(rows,cols));
        }

        private static long GetCount(int rows, int cols)
        {
            if(rows == 1)
            {
                return 1;
            }
            var res = 1L;
            var maxPows = new int[rows+1];
            var cntArr = GetCntArr(cols);
            for(var i = 2;i <= rows;i++)
            {
                var tmp = i;
                for(var j=2;j<rows;j++)
                {
                    if(tmp<= rows/i)
                    {
                        tmp*=i;
                        if(maxPows[tmp] == 0)
                            maxPows[tmp] = j;
                    }
                    else
                    {
                        break;
                    }
                }

                if(maxPows[i] == 0)
                {
                    res+= cols;
                }
                else
                {
                    res+= cntArr[maxPows[i]];
                }

            }
            return res;
        }

        private static int[] GetCntArr(int n)
        {
            var cntArr = new int[21];

            for(var i =2;i<=20;i++)
            {
                var usedArr = new bool[n+1];
                for(var j = 1;j < i;j++)
                {
                    var gcd = GetGCD(i,j);
                    var tmp = i/gcd;
                    for(var k=1;k<=n/tmp;k++)
                    {
                        usedArr[k * j/gcd] = true;
                    }
                }
                for(var k=1;k<=n;k++)
                {
                    if(!usedArr[k]) cntArr[i]++;
                }
            }

            return cntArr;

        }

        private static int GetGCD(int num0, int num1)
        {
            if(num0 < num1)
            {
                var tmp = num0;
                num0 = num1;
                num1 = tmp;
            }
            while(num1!=0)
            {
                var tmp = num0% num1;
                num0 = num1;
                num1 = tmp;
            }
            return num0;
        }

        private static int BruteGetCount(int rows, int cols)
        {
            var set = new HashSet<int>();
            for(var i =1;i<=rows;i++)
            {
                var tmp = 1;
                for(var j=1;j<=cols;j++)
                {
                    tmp*=i;
                    set.Add(tmp);
                }
            }
            return set.Count;
        }

    }
}

using System.Xml;
using System.ComponentModel.Design;
using System.Security.AccessControl;
using System.Globalization;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

namespace CodeForce
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ');
            var rows = Int32.Parse(arr[0]);
            var cols = Int32.Parse(arr[1]);
            Console.WriteLine(GetCount(rows,cols));

        }

        private static long GetCount(int rows, int cols)
        {
            if(rows == 1)
            {
                return 1;
            }
            var res = 1L;
            var maxPows = new int[rows+1];
            var cntArr = GetCntArr(cols);
            for(var i = 2;i <= rows;i++)
            {
                var tmp = i;
                for(var j=2;j<rows;j++)
                {
                    if(tmp<= rows/i)
                    {
                        tmp*=i;
                        if(maxPows[tmp] == 0)
                            maxPows[tmp] = j;
                    }
                    else
                    {
                        break;
                    }
                }

                if(maxPows[i] == 0)
                {
                    res+= cols;
                }
                else
                {
                    res+= cntArr[maxPows[i]];
                }

            }
            return res;
        }

        private static int[] GetCntArr(int n)
        {
            var cntArr = new int[21];

            for(var i =2;i<=20;i++)
            {
                var usedArr = new bool[n+1];
                for(var j = 1;j < i;j++)
                {
                    for(var k=1;k<=n;k++)
                    {
                        if(j*k % i == 0)
                        {
                            usedArr[j*k / i] = true;
                        }
                    }
                }
                for(var k=1;k<=n;k++)
                {
                    if(!usedArr[k]) cntArr[i]++;
                }
            }

            return cntArr;

        }

        private static int GetGCD(int num0, int num1)
        {
            if(num0 < num1)
            {
                var tmp = num0;
                num0 = num1;
                num1 = tmp;
            }
            while(num1!=0)
            {
                var tmp = num0% num1;
                num0 = num1;
                num1 = tmp;
            }
            return num0;
        }

        private static int BruteGetCount(int rows, int cols)
        {
            var set = new HashSet<int>();
            for(var i =1;i<=rows;i++)
            {
                var tmp = 1;
                for(var j=1;j<=cols;j++)
                {
                    tmp*=i;
                    set.Add(tmp);
                }
            }
            return set.Count;
        }

    }
}

// Online C# Editor for free
// Write, Edit and Run your C# code using C# Online Compiler

using System;

public class HelloWorld
{
    public static void Main(string[] args)
    {
        var arr = Console.ReadLine().Split(' ');

        int rows = Int32.Parse(arr[0]);
        int columns = Int32.Parse(arr[1]);
        //Console.WriteLine(rows);
       // Console.WriteLine(columns);
       Console.WriteLine(getUniqueNumbers(rows,columns));
    }

    public static int[] precalculate(int m){
        var cnt = new int[21];
        var vis = new bool[20000002];
        int c=0;
        for(int i=1;i<=20;++i){
            for(int j=1;j<=m;++j){
                if(!vis[i*j]){
                    vis[i*j]=true;
                    ++c;
                }
            }
            cnt[i]=c;
        }

        return cnt;
    }

    public static long getUniqueNumbers(int rows, int columns){
        var arr = precalculate(columns);

        long res=1;
        var vis = new bool[20000002];

        for(int i=2;i<=rows;++i){
            if(vis[i])continue;
            long j=i;
            int c=0;

            while(j<=(long)rows){
                vis[j]=true;
                j*=i;
                ++c;
            }

            res+= arr[c];
        }

        return res;
    }

}

using System.Xml;
using System.ComponentModel.Design;
using System.Security.AccessControl;
using System.Globalization;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

namespace CodeForce
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ');
            var rows = Int32.Parse(arr[0]);
            var cols = Int32.Parse(arr[1]);
            Console.WriteLine(GetCount(rows,cols));
        }

        private static long GetCount(int rows, int cols)
        {
            if(rows == 1)
            {
                return 1;
            }
            var res = 1L;
            var maxPows = new int[rows+1];
            var cntArr = GetCntArr(cols);
            for(var i = 2;i <= rows;i++)
            {
                var tmp = i;
                for(var j=2;j<rows;j++)
                {
                    if(tmp<= rows/i)
                    {
                        tmp*=i;
                        if(maxPows[tmp] == 0)
                            maxPows[tmp] = j;
                    }
                    else
                    {
                        break;
                    }
                }

                if(maxPows[i] == 0)
                {
                    res+= cols;
                }
                else
                {
                    res+= cntArr[maxPows[i]];
                }

            }
            return res;
        }

        private static int[] GetCntArr(int n)
        {
            var cntArr = new int[21];

            for(var i =2;i<=20;i++)
            {
                var usedArr = new bool[n+1];
                for(var j = 1;j < i;j++)
                {
                    var gcd = GetGCD(i,j);
                    var tmp = i/gcd;
                    for(var k=1;k<=n/tmp;k++)
                    {
                        usedArr[tmp*k / i] = true;
                    }
                }
                for(var k=1;k<=n;k++)
                {
                    if(!usedArr[k]) cntArr[i]++;
                }
            }

            return cntArr;

        }

        private static int GetGCD(int num0, int num1)
        {
            if(num0 < num1)
            {
                var tmp = num0;
                num0 = num1;
                num1 = tmp;
            }
            while(num1!=0)
            {
                var tmp = num0% num1;
                num0 = num1;
                num1 = tmp;
            }
            return num0;
        }

        private static int BruteGetCount(int rows, int cols)
        {
            var set = new HashSet<int>();
            for(var i =1;i<=rows;i++)
            {
                var tmp = 1;
                for(var j=1;j<=cols;j++)
                {
                    tmp*=i;
                    set.Add(tmp);
                }
            }
            return set.Count;
        }

    }
}

using System.Xml;
using System.ComponentModel.Design;
using System.Security.AccessControl;
using System.Globalization;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;

namespace CodeForce
{
    class Program
    {
        static void Main(string[] args)
        {
            var arr = Console.ReadLine().Split(' ');
            var rows = Int32.Parse(arr[0]);
            var cols = Int32.Parse(arr[1]);
            Console.WriteLine(GetCount(rows,cols));
        }

        private static long GetCount(int rows, int cols)
        {
            if(rows == 1)
            {
                return 1;
            }
            var res = 1L;
            var maxPows = new int[rows+1];
            var cntArr = GetCntArr(cols);
            for(var i = 2;i <= rows;i++)
            {
                var tmp = i;
                for(var j=2;j<rows;j++)
                {
                    if(tmp<= rows/i)
                    {
                        tmp*=i;
                        if(maxPows[tmp] == 0)
                            maxPows[tmp] = j;
                    }
                    else
                    {
                        break;
                    }
                }

                if(maxPows[i] == 0)
                {
                    res+= cols;
                }
                else
                {
                    res+= cntArr[maxPows[i]];
                }

            }
            return res;
        }

        private static int[] GetCntArr(int n)
        {
            var cntArr = new int[21];

            for(var i =2;i<=20;i++)
            {
                var usedArr = new bool[n+1];
                for(var j = 1;j < i;j++)
                {
                    var gcd = GetGCD(i,j);
                    var tmp = j/gcd;
                    for(var k=1;k<=n/tmp;k++)
                    {
                        usedArr[tmp*k / i] = true;
                    }
                }
                for(var k=1;k<=n;k++)
                {
                    if(!usedArr[k]) cntArr[i]++;
                }
            }

            return cntArr;

        }

        private static int GetGCD(int num0, int num1)
        {
            if(num0 < num1)
            {
                var tmp = num0;
                num0 = num1;
                num1 = tmp;
            }
            while(num1!=0)
            {
                var tmp = num0% num1;
                num0 = num1;
                num1 = tmp;
            }
            return num0;
        }

        private static int BruteGetCount(int rows, int cols)
        {
            var set = new HashSet<int>();
            for(var i =1;i<=rows;i++)
            {
                var tmp = 1;
                for(var j=1;j<=cols;j++)
                {
                    tmp*=i;
                    set.Add(tmp);
                }
            }
            return set.Count;
        }

    }
}