We have a non volatile flash memory with the following properties:
Page size is 400 bytes, in the beginning all pages are initialized to 1s
It is only possible to set a 1 into 0, not possible to set 0 back to 1.
It is possible to erase a page - setting all values to 1
After 1000 erase operations the page is damaged and finishes his life.
You need to implement a counter with this flash memory and a RAM. The counter should be maintained such that if the computer is turned off unexpectedly and on again the counter should still be valid up to missing 1 or to counts.