using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var dlist = GetMinPDivList(n); var primes = new List(); var pcount = new int[n + 1]; for (var i = 2; i <= n; ++i) if (dlist[i] == i) primes.Add(i); for (var i = 2; i <= n; ++i) { foreach (var p in PDiv(i, dlist)) ++pcount[p]; } var ans = 0L; var mod = 998_244_353; for (var e = 1; e <= pcount[2]; ++e) { var all = 1L; var rm = 1L; for (var ppos = 0; ppos < primes.Count; ++ppos) { if (pcount[primes[ppos]] / e == 0) break; all = all * (pcount[primes[ppos]] / e + 1) % mod; rm = rm * (pcount[primes[ppos]] / (e + 1) + 1) % mod; } ans = (ans + (all - rm + mod) % mod * e % mod) % mod; } WriteLine(ans); } static int[] GetMinPDivList(int max) { var minPDivList = new int[max + 1]; for (var i = 0; i <= max; ++i) minPDivList[i] = i; for (var i = 2; i * i <= max; ++i) if (minPDivList[i] == i) { for (var j = i * i; j <= max; j += i) if (minPDivList[j] == j) { minPDivList[j] = i; } } return minPDivList; } static List PDiv(int n, int[] minPDivList) { var p = minPDivList[n]; if (n == p) { var dic = new List(); dic.Add(p); return dic; } else { var dic = PDiv(n / p, minPDivList); dic.Add(p); return dic; } } }