How many distinct times was writing invented ?

by Loa_Ex_Machina

So, I've heard that nearly all European writings are derived from Greek, which might be derived from Phoenician, which itself might be derived from cuneiform (with some intermediates). Likewise in the far East, both Japanese and Korean writing systems are based on or inspired by Chinese. So how many times was writing invented separately, without being based on an already existing one ? I know one of the issues might be determining what we count as writing since nearly every culture in the world has had systems of symbols to convey more or less complexe meanings, so I'll let you narrow it down any way you find most convenient. Maybe if it's more simple, you could instead answer to "How many writing systems with no common origin among them are all the currently existing writing systems of the world based on ?"

Bentresh