#J, 25 bytes [:((0=+/)*/:~@:*-:*)2-/\] Idea stolen from the Jelly answers. Just wanted to see how short I could make it in J. [Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/o600NAxstfU1tfSt6hystHSttDSNdPVjYv9rcnGlJmfkKxgq2CqkAUkjBWMFczA0VjDElDIC0piixlhkLIEQmW@MwgPpMlEwVTADWgRSaQR1hgGKXchiICdZAKElUA@yOEQlumqQ2SDTzcC0CYocSBwkz6XA9R8A "J – Try It Online")