using System.Numerics; public class Program { public static void Main() { //int num = int.Parse(Console.ReadLine() ?? string.Empty); string[] str = (Console.ReadLine() ?? string.Empty).Trim().Split(' '); //string str = Console.ReadLine() ?? string.Empty; long l = long.Parse(str[0]); long r = long.Parse(str[1]); long m = long.Parse(str[2]); if (l.ToString().ToLower().Length >= 5) { Console.WriteLine(m); return; } List list = new List(); for (int i = (int)l; i <= r; i++) { long a = i % m; bool d = list.Contains(a); if (!d) { list.Add(a); } } Console.WriteLine(list.Count); } }