// $Id: hash.elastic,v 1.0 2002/05/21 14:38:00 dada Exp $
package xhash;

import basic;
import sys;
import array;
import hash;

private n = 1;
private i;
private c = 0;
private X = %[];

if(array.length(sys.args) > 0) {
    n = basic.int(sys.args[0]);
} else {
    n = 1;
}
for(i=1; i<=n; i++) {
    X[basic.sprintf("%x", i)] = i;
}
for(i=n; i>0; i=i-1) {
     if(hash.has_key(X, basic.sprintf("%d", i))) {
        c = c + 1;
    }
}
basic.print(c);