Time of residence Homeless persons according to time of residence in Spain for reasons for leaving the accommodation they had before becoming homeless Units: persons ;Total;From 0 to 12 months;From 13 to 35 months;From 3 to 5 years;More than 5 years; Total;28,552;3,300;2,401;2,644;20,207; Separation from partner;3,942;71;130;121;3,619; They or their children suffered from violence;2,705;580;335;136;1,654; The building where they lived was in ruins;697;22;43;41;590; Eviction from the dwelling;4,519;165;189;236;3,930; The rental contract ended;2,245;119;97;197;1,832; Loss of their job;7,522;274;297;578;6,373; Hospitalisation;3,117;113;113;204;2,687; They were deprived of their freedom;2,010;217;78;84;1,630; Change in municipality;2,697;280;444;309;1,664; They could no longer pay for accommodation;4,115;251;135;296;3,433; Having to start from scratch after emigrating to another country;8,061;2,673;1,829;1,520;2,039; Addiction problems;3,522;17;27;107;3,371; Departure or abandonment from a juvenile centre;771;26;55;294;396; Other causes;4,262;490;327;450;2,994; Not given;517;60;25;23;409; Notes: Source: National Statistics Institute