#include <stdio.h>
unsigned long long n, res;
int p, primes[ ] = { 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 51 , 53 , 59 , 61 , 67 , 71 } ;
unsigned long long mul( unsigned long long a, unsigned long long b) {
unsigned long long res = 0 ;
while ( b) {
if ( b & 1LL) res = ( res + a) ;
if ( res >= n) return 0 ;
a = ( a << 1LL) ;
b >>= 1LL;
}
return res;
}
void backtrack( int i, int lim, unsigned long long val, unsigned long long r) {
if ( r > res) res = r;
if ( i == p) return ;
int d;
unsigned long long x = val;
for ( d = 1 ; d <= lim; d++ ) {
x = mul( x, primes[ i] ) ;
if ( x == 0 ) return ;
backtrack( i + 1 , d, x, r * ( d + 1 ) ) ;
}
}
int main( ) {
/* Tested for n <= 10^18 */
p = sizeof ( primes) / sizeof ( int ) ;
while ( scanf ( "%llu" , & n
) != EOF
) { res = 0 ;
backtrack( 0 , 100 , 1 , 1 ) ;
printf ( "Maximum number of divisors of any number less than %llu = %llu\n " , n
, res
) ; }
return 0 ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp1bnNpZ25lZCBsb25nIGxvbmcgbiwgcmVzOwppbnQgcCwgcHJpbWVzW10gPSB7MiwgMywgNSwgNywgMTEsIDEzLCAxNywgMTksIDIzLCAyOSwgMzEsIDM3LCA0MSwgNDMsIDQ3LCA1MSwgNTMsIDU5LCA2MSwgNjcsIDcxfTsKCnVuc2lnbmVkIGxvbmcgbG9uZyBtdWwodW5zaWduZWQgbG9uZyBsb25nIGEsIHVuc2lnbmVkIGxvbmcgbG9uZyBiKXsKICAgIHVuc2lnbmVkIGxvbmcgbG9uZyByZXMgPSAwOwoKICAgIHdoaWxlIChiKXsKICAgICAgICBpZiAoYiAmIDFMTCkgcmVzID0gKHJlcyArIGEpOwogICAgICAgIGlmIChyZXMgPj0gbikgcmV0dXJuIDA7CiAgICAgICAgYSA9IChhIDw8IDFMTCk7CiAgICAgICAgYiA+Pj0gMUxMO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