For any three distinct odd (or even) numbers, the difference between the largest and the smallest must be an even number not less than 4, which is a contradiction. Therefore, the set $A$ can have at most two odd numbers and at most two even numbers, so $n=4$.
Since $2023 \in A$, then $A$ can only have the following two cases:
$A=\{2021,2023,2 k, 2 k+2\}$ or $A=\{2023,2025,2 k, 2 k+2\}$, where $k$ is a positive integer.
(1) When $A=\{2021,2023,2 k, 2 k+2\}$, note that $2 k-2019,2 k-2021,2 k-2023$ are three consecutive odd numbers, so exactly one of them is a multiple of 3, i.e., $|2 k-2019|,|2 k-2021|,|2 k-2023|$ is 3.
$|2 k-2019|=3 \Rightarrow 2 k=2016$ or $2 k=2022$, then $A=\{2021,2023,2016,2018\}$ or $A=\{2021,2023,2022,2024\}$, upon inspection, $A=\{2021,2023,2016,2018\}$ satisfies the condition; $|2 k-2021|=3 \Rightarrow 2 k=2018$ or $2 k=2024$, then $A=\{2021,2023,2018,2020\}$ or $A=\{2021,2023,2024,2026\}$, upon inspection, neither satisfies the condition; $|2 k-2023|=3 \Rightarrow 2 k=2020$ or $2 k=2026$, then $A=\{2021,2023,2020,2022\}$ or $A=\{2021,2023,2026,2028\}$, upon inspection, $A=\{2021,2023,2026,2028\}$ satisfies the condition;
(2) When $A=\{2023,2025,2 k, 2 k+2\}$, similarly, $|2 k-2021|,|2 k-2023|,|2 k-2025|$ has exactly one number that is 3.
$|2 k-2021|=3 \Rightarrow 2 k=2018$ or $2 k=2024$, then $A=\{2023,2025,2018,2020\}$ or $A=\{2023,2025,2024,2026\}$, upon inspection, $A=\{2023,2025,2018,2020\}$ satisfies the condition; $|2 k-2023|=3 \Rightarrow 2 k=2020$ or $2 k=2026$, then $A=\{2023,2025,2020,2022\}$ or $A=\{2023,2025,2026,2028\}$, upon inspection, neither satisfies the condition; $|2 k-2025|=3 \Rightarrow 2 k=2022$ or $2 k=2028$, then $A=\{2023,2025,2022,2024\}$ or $A=\{2023,2025,2028,2030\}$, upon inspection, $A=\{2023,2025,2028,2030\}$ satisfies the condition. In summary, there are 4 sets $A$ that meet the conditions.
10. Let the integer $n \geqslant 4, A=\left\{a_{1}, a_{2}, \cdots, a_{n}\right\}$ be a set of integers, satisfying $2023 \in A$, and the absolute difference between any two elements of $A$ is a prime number. Then the number of such sets $A$ is $\qquad$.