COCI 2006/2007, Contest #1

Task MODULO

Given two integers A and B, A modulo B is the remainder when dividing A by B. For example, the numbers 7, 14, 27 and 38 become 1, 2, 0 and 2, modulo 3. Write a program that accepts 10 numbers as input and outputs the number of distinct numbers in the input, if the numbers are considered modulo 42.

Input

The input will contain 10 non-negative integers, each smaller than 1000, one per line.

Output

Output the number of distinct values when considered modulo 42 on a single line.

Sample Tests

Input

1
2
3
4
5
6
7
8
9
10

Output

10

Input

42
84
252
420
840
126
42
84
420
126

Output

1

Input

39
40
41
42
43
44
82
83
84
85

Output

6

Clarification

In the first example, the numbers modulo 42 are 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10.

In the second example all numbers modulo 42 are 0.

In the third example, the numbers modulo 42 are 39, 40, 41, 0, 1, 2, 40, 41, 0 and 1. There are 6 distinct numbers.

All Submissions
Best Solutions


Point Value: 5
Time Limit: 1.00s
Memory Limit: 32M
Added: Jan 13, 2009

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

I have read the problem about 3 times and I still don't understand it. I came up with a solution but it's wrong and I don't know where I am messing up.

The problem is straightforward. Is there any particular part that you don't understand? You may find it helpful to read the Wikipedia article on modulo.