Algorithm for a loneliness