In this Kata, you will be given a number and your task will be to rearrange the number so that it is divisible by `25`, but without leading zeros. Return the minimum number of digit moves that are needed to make this possible. If impossible, return `-1` ( `Nothing` in Haskell ).

For example:

More examples in test cases.

Good luck!

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

def _disabled_input(*args, **kwargs):
    raise RuntimeError("input() is disabled in callable mode")
builtins.input = _disabled_input

ns = {"__name__": "__judge__"}  # prevent if __name__ == "__main__" blocks
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def solve(n):\n    min_cost = -1\n    # Change the number to a string and reverse it.\n    # This makes it possible to use .index to find the lowest place a digit appears.\n    s = str(n)[::-1]\n    # Calculate cost of each possible ending digit pair and keep the lowest cost at each point.\n    for pair in (\'00\', \'25\', \'50\', \'75\'):\n        cost = calculate_ending_pair_cost(s, pair)\n        if min_cost == -1 or (cost != -1 and cost < min_cost):\n            min_cost = cost\n\n    return min_cost\n\ndef calculate_ending_pair_cost(s, pair):\n    # First find the lowest place indices of each desired digit.\n    indices = find_lowest_places(s, pair)\n    # If we can\'t find one of the digits, then this ending pair is not possible.\n    if indices is None:\n        return -1\n    # Start with an indicator of whether the desired digits are in the wrong order.\n    cost = 1 if indices[1] > indices[0] else 0\n    # Then swap the digits so the rest of our calculations are easier.\n    # It\'s important to have these index numbers in descending order.\n    if cost == 1:\n        indices = (indices[1], indices[0])\n    # Our number now looks something like this: aaa2bbbb5ccccc\n    # The cost should be the number of digits (b\'s) we have to displace to move the 2 next to the 5,\n    # and then twice the number of digits to displace to move the 2 and 5 to the "front".\n    # This is because each c must move past both the 5 and the 2.\n    cost += indices[0] - indices[1] - 1\n    cost += 2 * indices[1]\n    # We have one last special case to consider: What about leaving leading 0\'s in the high places?\n    # We only bother with this if the number is more than 2 digits.\n    if len(s) > 2:\n        non_zero_index = first_non_zero_digit_after_indices(s, indices)\n        if non_zero_index is None:\n            return -1\n        cost += len(s) - 1 - non_zero_index\n        # Make sure not to double-count any digits we already moved as part of the desired digits.\n        cost -= 1 if indices[0] > non_zero_index else 0\n        cost -= 1 if indices[1] > non_zero_index else 0\n    \n    return cost\n\ndef find_lowest_places(s, pair):\n    # Split the two-char string into the 1s place digit and 10s place digit.\n    d10, d1 = pair\n    try:\n        i1 = s.index(d1)\n    except:\n        # Index raises an exception if it can\'t find the digit,\n        # so just use that as an indicator of when to return a failure state.\n        return None\n    \n    # If the pair we\'re looking for is a repeated digit (\'00\'), then we need to start\n    # searching the string at the index just beyond that point.\n    start = 0\n    if d1 == d10:\n        start = i1 + 1\n    try:\n        i10 = s.index(d10, start)\n    except:\n        return None\n    \n    return (i10, i1)\n\ndef first_non_zero_digit_after_indices(s, indices):\n    # We need to reverse the string and indices because we\'re actually searching\n    # from the highest place in the number now.\n    s = s[::-1]\n    indices = [len(s) - 1 - indices[i] for i in range(len(indices))]\n    # Now search through linearly for the first non-zero digit which is not an index.\n    non_zero_index = None\n    for i in range(len(s)):\n        if i not in indices and s[i] != \'0\':\n            non_zero_index = i\n            break\n    # If we didn\'t find a non-zero index, that means we\'re dealing with something like\n    # trying to use \'25\' as the final digits of 250. In other words, impossible.\n    if non_zero_index is None:\n        return None\n    # Otherwise, translate the index back into place number.\n    return len(s) - 1 - non_zero_index'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

_target = None
_fn_name = 'solve'
if _fn_name:
    if "Solution" in ns:
        try:
            _obj = ns["Solution"]()
            if hasattr(_obj, _fn_name):
                _target = getattr(_obj, _fn_name)
        except Exception:
            _target = None
    if _target is None and _fn_name in ns and callable(ns[_fn_name]):
        _target = ns[_fn_name]
# Fallback: if there's exactly one user-defined function, use it
if _target is None:
    _cands = [v for k, v in ns.items() if callable(v) and getattr(v, "__module__", "") in ("__judge__", "__main__")]
    _user_funcs = [c for c in _cands if getattr(c, "__name__", "").startswith("_") is False]
    if len(_user_funcs) == 1:
        _target = _user_funcs[0]
if _target is None:
    raise RuntimeError(f"Could not resolve callable '{_fn_name}'")

_raw = sys.stdin.read().strip()
if _raw:
    _parsed = json.loads(_raw)
    if isinstance(_parsed, dict):
        _kwargs = _parsed.get("kwargs", {})
        _args = _parsed.get("args", [])
    else:
        _args, _kwargs = _parsed, {}
else:
    _args, _kwargs = [], {}
if not isinstance(_args, (list, tuple)):
    _args = [_args]
_res = _target(*_args, **_kwargs)
try:
    sys.stdout.write(repr(_res) + "\n")
except Exception:
    pass

```

Measured memory_bytes: 6173