You are given a string S consisting of lowercase English letters.
Determine whether we can turn S into a palindrome by repeating the operation of swapping two adjacent characters. If it is possible, find the minimum required number of operations.

-----Constraints-----
 - 1 \leq |S| \leq 2 × 10^5
 - S consists of lowercase English letters.

-----Input-----
Input is given from Standard Input in the following format:
S

-----Output-----
If we cannot turn S into a palindrome, print -1. Otherwise, print the minimum required number of operations.

-----Sample Input-----
eel

-----Sample Output-----
1

We can turn S into a palindrome by the following operation:
 - Swap the 2-nd and 3-rd characters. S is now ele.

```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

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'import collections\n\n\nclass Bit():\n    def __init__(self, l):\n        self.size = l\n        self.bit = [0] * (self.size+1)\n\n    def sum(self, i):\n        s = 0\n        while i > 0:\n            s += self.bit[i]\n            i -= i & -i\n        return s\n\n    def add(self, i, x):\n        while i <= self.size:\n            self.bit[i] += x\n            i += i & -i\n\n    def __str__(self):\n        return str(self.bit)\n\n\nS = str(input())\nN = len(S)\nindex = collections.defaultdict(list)\n\nfor i, c in enumerate(S):\n    index[c].append(i)\n\nctr = N // 2\nB = [0] * N\nflag = 0\nP = []\n\nfor c, k in list(index.items()):\n    cnt = len(k)\n    if cnt % 2:\n        if flag == 1:\n            print((-1))\n            return\n        flag = 1\n        B[k[cnt // 2]] = ctr + 1\n    for i in range(cnt // 2):\n        l, r = k[i], k[-(i+1)]\n        P.append((l, r))\n\nP.sort()\n\nfor i, (l, r) in enumerate(P):\n    B[l], B[r] = i + 1, N - i\n\nans = 0\nbit = Bit(N)\nfor i, b in enumerate(B):\n    ans += i - bit.sum(b)\n    bit.add(b, 1)\n\nprint(ans)\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: