Flat ownership

What is the rule of ownwership of a flat?If building colapses than how it will be compensated?