#include <bits/stdc++.h>
using namespace std;
long long arr1[1000001];
template <typename T>
T myMax(T x, T y) {
  return (x > y) ? x : y;
}
template <typename T>
T myMin(T x, T y) {
  return (x < y) ? x : y;
}
template <typename T>
T sum(T x, T y) {
  return (x + y);
}
template <typename T>
T Mean(T x, T y) {
  return (x + ((y - x) / 2));
}
void seive() {
  for (long long i = 0; i <= 1000000; i++) {
    arr1[i] = 1;
  }
  for (long long i = 2; i * i <= 1000000; i++) {
    if (arr1[i] == 1) {
      arr1[i] = 1;
      for (long long j = i * i; j <= 1000000; j = j + i) {
        arr1[j] = 0;
      }
    }
  }
}
long long find_occurances(string s) {
  string s1 = "";
  long long c = 0;
  for (long long i = 0; i < 3; i++) {
    s1 = s1 + s[i];
  }
  if (s1 == "abc") {
    c++;
  }
  long long n = s.size();
  long long l = 0;
  long long r = 2;
  while (r < n - 1) {
    s1.erase(s1.begin());
    l++;
    r++;
    s1 += s[r];
    if (s1 == "abc") {
      c++;
    }
  }
  return c;
}
bool check_power_of_2(long long x) {
  if ((x & (x - 1)) == 0) {
    return true;
  }
  return false;
}
bool cmp(pair<long long, pair<long long, long long>> x,
         pair<long long, pair<long long, long long>> y) {
  if (x.first == y.first) {
    return x.second.second < y.second.second;
  }
  return x.first < y.first;
}
bool cmp1(pair<long long, long long> p, pair<long long, long long> q) {
  return p.first < q.second;
}
bool check(vector<long long>& v) {
  if (v[0] == 1) {
    bool flag1 = true;
    for (long long i = 1; i < v.size(); i++) {
      if (v[i] != v[i - 1]) {
        flag1 = false;
        break;
      }
    }
    return flag1;
  } else {
    return false;
  }
}
bool check_prime(long long x) {
  if (x == 2) {
    return true;
  }
  if (x == 3) {
    return true;
  }
  if ((x % 2) == 0) {
    return false;
  }
  if ((x % 3) == 0) {
    return false;
  }
  for (long long i = 5; i * i <= x; i = i + 6) {
    if ((x % i) == 0) {
      return false;
    }
    if ((x % (i + 2)) == 0) {
      return false;
    }
  }
  return true;
}
bool check_array(vector<long long>& v) {
  for (long long i = 1; i < v.size(); i++) {
    if (v[i] == v[i - 1]) return false;
  }
  return true;
}
bool is_vowel(char x) {
  if ((x == 'a') || (x == 'e') || (x == 'o') || (x == 'i') || (x == 'u')) {
    return true;
  }
  return false;
}
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long arr[n];
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
    }
    if ((sum % n) == 0) {
      cout << 0 << "\n";
    } else {
      cout << 1 << "\n";
    }
  }
  return 0;
}

### Prompt

Please formulate a cpp solution to the following problem:

There are n block towers in a row, where tower i has a height of a_i. You're part of a building crew, and you want to make the buildings look as nice as possible. In a single day, you can perform the following operation:

  * Choose two indices i and j (1 ≤ i, j ≤ n; i ≠ j), and move a block from tower i to tower j. This essentially decreases a_i by 1 and increases a_j by 1. 



You think the ugliness of the buildings is the height difference between the tallest and shortest buildings. Formally, the ugliness is defined as max(a)-min(a). 

What's the minimum possible ugliness you can achieve, after any number of days?

Input

The first line contains one integer t (1 ≤ t ≤ 1000) — the number of test cases. Then t cases follow.

The first line of each test case contains one integer n (2 ≤ n ≤ 100) — the number of buildings.

The second line of each test case contains n space separated integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^7) — the heights of the buildings.

Output

For each test case, output a single integer — the minimum possible ugliness of the buildings.

Example

Input


3
3
10 10 10
4
3 2 1 2
5
1 2 3 1 5


Output


0
0
1

Note

In the first test case, the ugliness is already 0.

In the second test case, you should do one operation, with i = 1 and j = 3. The new heights will now be [2, 2, 2, 2], with an ugliness of 0.

In the third test case, you may do three operations: 

  1. with i = 3 and j = 1. The new array will now be [2, 2, 2, 1, 5], 
  2. with i = 5 and j = 4. The new array will now be [2, 2, 2, 2, 4], 
  3. with i = 5 and j = 3. The new array will now be [2, 2, 3, 2, 3]. 

The resulting ugliness is 1. It can be proven that this is the minimum possible ugliness for this test.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long arr1[1000001];
template <typename T>
T myMax(T x, T y) {
  return (x > y) ? x : y;
}
template <typename T>
T myMin(T x, T y) {
  return (x < y) ? x : y;
}
template <typename T>
T sum(T x, T y) {
  return (x + y);
}
template <typename T>
T Mean(T x, T y) {
  return (x + ((y - x) / 2));
}
void seive() {
  for (long long i = 0; i <= 1000000; i++) {
    arr1[i] = 1;
  }
  for (long long i = 2; i * i <= 1000000; i++) {
    if (arr1[i] == 1) {
      arr1[i] = 1;
      for (long long j = i * i; j <= 1000000; j = j + i) {
        arr1[j] = 0;
      }
    }
  }
}
long long find_occurances(string s) {
  string s1 = "";
  long long c = 0;
  for (long long i = 0; i < 3; i++) {
    s1 = s1 + s[i];
  }
  if (s1 == "abc") {
    c++;
  }
  long long n = s.size();
  long long l = 0;
  long long r = 2;
  while (r < n - 1) {
    s1.erase(s1.begin());
    l++;
    r++;
    s1 += s[r];
    if (s1 == "abc") {
      c++;
    }
  }
  return c;
}
bool check_power_of_2(long long x) {
  if ((x & (x - 1)) == 0) {
    return true;
  }
  return false;
}
bool cmp(pair<long long, pair<long long, long long>> x,
         pair<long long, pair<long long, long long>> y) {
  if (x.first == y.first) {
    return x.second.second < y.second.second;
  }
  return x.first < y.first;
}
bool cmp1(pair<long long, long long> p, pair<long long, long long> q) {
  return p.first < q.second;
}
bool check(vector<long long>& v) {
  if (v[0] == 1) {
    bool flag1 = true;
    for (long long i = 1; i < v.size(); i++) {
      if (v[i] != v[i - 1]) {
        flag1 = false;
        break;
      }
    }
    return flag1;
  } else {
    return false;
  }
}
bool check_prime(long long x) {
  if (x == 2) {
    return true;
  }
  if (x == 3) {
    return true;
  }
  if ((x % 2) == 0) {
    return false;
  }
  if ((x % 3) == 0) {
    return false;
  }
  for (long long i = 5; i * i <= x; i = i + 6) {
    if ((x % i) == 0) {
      return false;
    }
    if ((x % (i + 2)) == 0) {
      return false;
    }
  }
  return true;
}
bool check_array(vector<long long>& v) {
  for (long long i = 1; i < v.size(); i++) {
    if (v[i] == v[i - 1]) return false;
  }
  return true;
}
bool is_vowel(char x) {
  if ((x == 'a') || (x == 'e') || (x == 'o') || (x == 'i') || (x == 'u')) {
    return true;
  }
  return false;
}
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long arr[n];
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
      sum += arr[i];
    }
    if ((sum % n) == 0) {
      cout << 0 << "\n";
    } else {
      cout << 1 << "\n";
    }
  }
  return 0;
}

```