Find all topology on finite set in especial case Let $X$ be finite set, Find all topology on finite set with this condition:


*

*For every subset $A \subset X$, either $A$ is open or $A$ is closed.


I find one of them:
$$T=\{ \emptyset, X, \{1\}, \{3\},...,\{n\},\{1,3\},\{1,4\},...\{1,n\},\{1,3,4\},...,\{1,3,4,...,n\}\} = \{A \subset X \bigm| A=X \, \text{or} \, 2 \not\in A \}
$$
It is clear that $T$ is topology and $T \neq P(X)$. Note that discrete topology is a trivial answer. So find the number of all topology with above condition.
 A: A topology on a finite set $X$ is the same as a preorder: given a preorder $\leq$, the collection of all sets $U$ such that $x\in U$ and $y\geq x$ implies $y\in U$ is a topology, and every topology comes from a unique preorder in this way.
The condition that every singleton is either open or closed means that $\leq$ is a partial order (i.e., $x\leq y$ and $y\leq x$ implies $x=y$) and every element of $X$ is either a minimal element or a maximal element.  Now suppose $x$ is a maximal element which is not minimal and $y$ is a minimal element that is not maximal.  If $\{x,y\}$ is open, then no element other than $x$ can be $>y$, and since $y$ is not maximal, we must have $x>y$.  Similarly, if $\{x,y\}$ is closed, then $y<x$ and $y$ is the only element that is $<x$.  So we must have $x>y$ and either $x$ is the only element $>y$ or $y$ is the only element $<x$.
It now follows easily that there must either be at most one maximal element that is not minimal or at most one minimal element which is not maximal.  Suppose $x$ is the unique maximal element that is not minimal.  Then every minimal element that is not maximal must be $<x$, and this completely determines the order.  In detail, we can split $X=A\cup B\cup\{x\}$, where $A$ is the set of points which are both maximal and minimal, and $B$ is the set of points which are minimal but not maximal, and then the order relation on $X$ is defined by $s<t$ iff $t=x$ and $s\in B$.  Dually, if $X$ has a unique minimal element $y$ that is not maximal, we can split $X=A\cup C\cup\{y\}$, and $X$ is ordered by $s<t$ iff $s=y$ and $t\in C$.  Finally, if $X$ has no minimal element that is not maximal or maximal element that is not minimal, then $X$ has the trivial order (i.e., any two distinct elements of $X$ are incomparable).
You can check that in all three cases, every subset of $X$ is either open or closed.  In the case where $X=A\cup B\cup\{x\}$, a set is open if it contains $x$, and closed if it does not contain $x$.  In the case where $X=A\cup C\cup\{y\}$, a set is closed if it contains $y$, and open if it does not contain $y$.  In the case that $X$ has the trivial order, every set is open and closed.
