Logic Synthesis with AND and OR Gates in Two Levels