How to find number of different elements?

We have $A_0,A_1,\dots,A_5$ sets, with the same length $|A_0|=\cdots=|A_5|=5$. We know that

• $A_i\cap A_{i\pm 1}=\varnothing$
• $|A_i\cap A_{j}|=2$, when $j\neq i\pm 1$ and $j\neq i$
• for all different $i,j,k,l$, if $A_i\cap A_j\neq\varnothing$ and $A_k\cap A_l\neq\varnothing,$ we have $A_i\cap A_j\neq A_k\cap A_l$

Here we suppose that $A_0=A_6,$ $A_{-1}=A_5,$ $A_i=A_{i ~\mathrm{mod}(6)}$.

How can find length of $A_0\cup A_1\cup\cdots A_6$ set?

If we calculate it directly, by hand we will get 14, but I am interested in algorithmic way to find solution, because this task can be generalized so that: we have $A_0,A_1,\dots,A_n$ set, $|A_0|=\cdots=|A_n|=a_n$ and second will become $|A_i\cap A_{j}|=b_n.$

• These conditions can't hold. Consider $i=k=0$, $j=l=2$. By the second condition $\left|A_0\cap A_2\right|=2$, so $A_0\cap A_2\neq\varnothing$. Hence by the third condition $A_0\cap A_2 \neq A_0\cap A_2$, a contradiction. – Christoph Dec 11 '15 at 12:31
• @Christoph Perhaps the third condition is missing the assumption that $\{i,j\}\not=\{k,l\}$. – Michael Burr Dec 11 '15 at 12:35
• I don't know. Also the second condition would imply that $\left|A_i\right| = \left|A_i \cap A_i\right| = 2\neq 5$. So it is probably also missing the assumption $i\neq j$. – Christoph Dec 11 '15 at 12:37
• I made few changes, now it should be hold conditions – Giorgi Dec 11 '15 at 14:28