for(v=n=0;v<2e3;v-1||println(n))v=v>4?"$v".grep{1}.sum{it.toLong()**2}:++n