$\space \space$ *Ahead of You, Down the Path*
$\space \space$ *A Majestic, Magical Faire!*
$\space \space$ *Ignore the Darkened, Eerie Woods*
$\space \space$ *Ignore the Eyes That Blink and Stare*
$\space \space$ *Fun & Games & Wondrous Sights!*
$\space \space$ *Music & Fireworks to Light Up the Night!*
$\space \space$ *Do Not Stop! You're Nearly There!*
$\space \space$ *Behold, My Friend: THE DARKMOON FAIRE!*
One day, you go to the Darkmoon Faire with your friends.
You begin to play a game called "Finding the Ridiculous Partitions"!
An array is "ridiculous", if the maximum element of the array lies on an odd index, while the minimum element of the array lies on an even index.
You are given a sequence $a$ of length $n$. It's guaranteed that all $a_i$ are pairwise distinct.
You can partition the sequence into several (probably one) continuous intervals, such that the intervals don't intersect and that every position belongs to exactly one interval. For every interval, we can view it as a one-based array. A partition is "ridiculous", if for each of the intervals, its corresponding array is ridiculous.
Please calculate the number of "ridiculous partitions" of the given sequence.
Since the answer can be very large, you only need to output the answer modulo 998244353.