Given two integers and , modulo is the remainder when dividing by . For example, the numbers , , and become , , and , modulo . Write a program that accepts numbers as input and outputs the number of distinct numbers in the input, if the numbers are considered modulo .
Input Specification
The input will contain non-negative integers, each smaller than , one per line.
Output Specification
Output the number of distinct values when considered modulo on a single line.
Sample Input 1
1
2
3
4
5
6
7
8
9
10
Sample Output 1
10
Explanation for Sample Output 1
The numbers modulo are , , , , , , , , and .
Sample Input 2
42
84
252
420
840
126
42
84
420
126
Sample Output 2
1
Explanation for Sample Output 2
All numbers modulo are .
Sample Input 3
39
40
41
42
43
44
82
83
84
85
Sample Output 3
6
Explanation for Sample Output 3
The numbers modulo are , , , , , , , , and . There are distinct numbers.
Comments