In this article we will discuss different ways to count number of elements in a flat list, lists of lists or nested lists. {1,2} and ϕ is a subset Number of Elements in Power Set For a given set S with n elements, number of elements in P(S) is 2^n. As each element has two possibilities (present or absent}, possible subsets are 2×2×2.. n … A set X of n elements has 2^n subsets, and the set consisting of these subsets (namely its power set P(X)), has 2^2^n subsets in all. {1,2} n=2 subsets =2^2 =4 = ϕ, {1}, {2},{1,2} every set is a subset of itself i.e. [math]\quad|\mathcal P(S\times S)|=2^{|S|^2}[/math] A relation on a set, [math]S[/math], is a subset of [math]S\times S[/math]. Count elements in a flat list Suppose we have a list i.e. Let S be the set of all integers from 100 to 999 which are neither divisible by 3 nor divisible by 5. If n is the number of elements in the set then No. The total number of such relations is the cardinality of the power set, [math]\mathcal P(S\times S # List of strings listOfElems = ['Hello', 'Ok', 'is', 'Ok', 'test', 'this A General Note: Formula for the Number of Subsets of a Set A set containing n distinct objects has [latex]{2}^{n}[/latex] subsets. Ex. of subsets possible for this subset is 2^n (2 raise to the power n).