{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.MArray as MA
import Control.Monad.ST

modN = 1000000007


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as =
    let (fo, la) = span f as
        las      = case la of
            [] -> []
            xs -> split f $ tail xs
    in  case fo of
            [] -> las
            xs -> xs : las

pow :: Int -> Int -> Int -> Int
pow base 1 modNum = base `mod` modNum
pow base time modNum
    | odd time = let 
        a = pow base (time `div` 2) modNum `mod` modNum
        in
        a * a * base `mod` modNum
    | otherwise = let
        a = pow base (time `div` 2) modNum `mod` modNum
        in
        a * a `mod` modNum

solve :: Int -> Int -> Int -> [Int]
solve n x y = let
    next a 
        | a == x = filter (<= n) . filter (>0) $ [a+1,a-1,y]
        | a == y = filter (<= n) . filter (>0) $ [a+1,a-1,x]
        | otherwise = filter (<= n) . filter (>0) $ [a+1,a-1]
    bfs :: STA.STArray s Int Int -> [Int] -> Int -> ST s ()
    bfs arr [] _ = pure ()
    bfs arr queue len = do
        forM_ queue $ \node -> do 
            currentLen <- MA.readArray arr node
            if currentLen /= -1 then pure () else
                MA.writeArray arr node len
        let n =  do
                node <- queue
                next node
        next_queue <- filterM (\a -> (-1 ==) <$> MA.readArray arr a) n
        bfs arr next_queue (len + 1)
    ansArr :: A.Array Int Int
    ansArr = STA.runSTArray $ do
            mainArr <- MA.newArray (1, (n - 1)) 0 
            forM_ [1..n] $ \start -> do
                arr <- MA.newArray (1, n) (negate 1)
                bfs arr [start] 0
                forM_ [1..n] $ \node -> do
                    dist <- MA.readArray arr node
                    when (dist /= 0) $ do
                        current <- MA.readArray mainArr dist
                        MA.writeArray mainArr dist (current + 1)
            pure mainArr
    in
    (\dist -> (`div` 2) $ ansArr A.! dist) <$> [1..(n - 1 )]



main = do
    (n, x, y) <- readTuple3
    forM_ (solve n x y) print







Measured memory_bytes: 193916