using System; using System.Collections.Generic; using System.Linq; // No.810 割った余りの個数 namespace No._810 { class Program { static void Main(string[] args) { int L, R, M; int[] p = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); L = p[0]; R = p[1]; M = p[2]; var dic = new Dictionary(); int div; for (int i = L; i <= R; i++) { div = i % M; if (!dic.ContainsKey(div)) { dic.Add(div, 0); } } Console.WriteLine(dic.Count()); } } }