{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"Tommy Shelby, the well-known member of the famous street gang \u003ci\u003eThe Peaky Blinders\u003c/i\u003e is moving to Birmingham. His family lives there in \u003ci\u003eAdderly Street\u003c/i\u003e. They are a very close family and have regular meetings to plan their next move. Tommy wants to find a house close to them so he can visit them regularly. \n\u003cp\u003e\nTommy has zero idea about how to minimize the total distance to all his family members’ houses and has hired you to help him solve this problem using your programming skills.\n\u003cp\u003e\n\n\u003cb\u003eInput\u003c/b\u003e\n\u003cp\u003e\nYou will receive several test cases. The first line will contain the number of test cases you need to address. For each test case you will have the number of family members \u003ci\u003em\u003c/i\u003e which is an integer number between 0 and 500 exclusive, the street numbers where they live \u003ci\u003en\u003csub\u003e1\u003c/sub\u003e, n\u003csub\u003e2\u003c/sub\u003e, …, n\u003csub\u003ei\u003c/sub\u003e, …, n\u003csub\u003er\u003c/sub\u003e\u003c/i\u003e; where n\u003csub\u003ei\u003c/sub\u003e is an integer number between 0 and 30000 exclusive. It is important to note that several family members could live in the same street number. \n\u003cp\u003e\n\n\u003cb\u003eOutput\u003c/b\u003e\n\u003cp\u003e\nFor each test case your program must write the minimal sum of distances from the optimal Tommy’s house to each one of his relatives. The distance between two street numbers n\u003csub\u003ei\u003c/sub\u003e and n\u003csub\u003ej\u003c/sub\u003e is d\u003csub\u003eij\u003c/sub\u003e \u003d |n\u003csub\u003ei\u003c/sub\u003e - n\u003csub\u003ej\u003c/sub\u003e|\n\n\u003cp\u003e\n\u003cb\u003eSample Input\u003c/b\u003e\n\u003cp\u003e\n2\u003cbr\u003e\n2 2 4\u003cbr\u003e\n3 2 4 6\u003cbr\u003e\n\n\u003cp\u003e\n\u003cb\u003eSample Output\u003c/b\u003e\n\u003cp\u003e\n2\u003cbr\u003e\n4\u003cbr\u003e"}}]}