Write SQL query to solve given problem: How many books were written by author A.J. Ayer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
SELECT COUNT(*) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id WHERE T2.author_name = 'A.J. Ayer'