import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		int res = n - (n == 1);
		foreach (i; 0..n)
		{
			foreach (j; i + 1..n)
			{
				auto num = a[j] - a[i];
				auto den = j - i;
				int cur = 0;
				foreach (k; 0..n)
				{
					auto value = num * (k - i);
					cur += (a[k] - a[i]) * den != value;
				}
				res = min (res, cur);
			}
		}
		writeln (res);
	}
}
