#K89057. Maximum Cow Grouping

    ID: 37445 Type: Default 1000ms 256MiB

Maximum Cow Grouping

Maximum Cow Grouping

You are given an integer ( n ) representing the number of cows. Your task is to form groups such that each group contains an equal number of cows and there are no cows left ungrouped. In other words, you need to find the largest divisor ( d ) of ( n ) (with ( 1 \leq d < n )) such that ( n ) can be divided into groups of equal size. If no divisor other than ( n ) itself exists (i.e. when ( n ) is prime or ( n = 1 )), then the answer is ( 1 ).

Example: For ( n = 12 ), the maximum number of groups is ( 6 ) since ( 12 = 6 \times 2 ) and 6 is the largest divisor less than 12.

inputFormat

Input is read from standard input (stdin) and consists of a single integer ( n ) (with ( 1 \le n \le 10^6 )) representing the number of cows.

outputFormat

Output to standard output (stdout) a single integer, which is the maximum number of groups that can be formed.## sample

12
6