Use xrange instead of range.