#include <bits/stdc++.h>
using namespace std;
void mycode();
const long long int mod = 998244353;
long long int ceil(long long int a, long long int b) { return (a + b - 1) / b; }
long long int min(long long int a, long long int b) {
  if (a > b)
    return b;
  else
    return a;
}
bool bit_check(long long int a, int i) {
  if ((a & ((long long)1 << (i - 1)))) return 1;
  return 0;
}
long long int bit_toggle(long long int a, int i) {
  return (a ^ ((long long)1 << (i - 1)));
}
long long int bit_sum(long long int a, int i) {
  return a + ((long long)1 << (i - 1));
}
long long int bit_sub(long long int a, int i) {
  return a - ((long long)1 << (i - 1));
}
long long int mod_power(long long int x, long long int y) {
  long long int p = mod;
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int power_of(long long int a, int b) {
  if (a == 0) return -1;
  return 1 + power_of(a / b, b);
}
long long power(long long int a, long long int b) {
  if (a == 1) return 1;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int main() {
  mycode();
  return 0;
}
void mycode() {
  int t;
  cin >> t;
  while (t--) {
    int n, a = 0, b = 0, k;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> k;
      if ((k & 1) != (i & 1)) {
        if (i & 1)
          a++;
        else
          b++;
      }
    }
    if (a == b)
      cout << a << '\n';
    else
      cout << -1 << '\n';
  }
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

You are given an array a[0 … n-1] of length n which consists of non-negative integers. Note that array indices start from zero.

An array is called good if the parity of each index matches the parity of the element at that index. More formally, an array is good if for all i (0 ≤ i ≤ n - 1) the equality i mod 2 = a[i] mod 2 holds, where x mod 2 is the remainder of dividing x by 2.

For example, the arrays [0, 5, 2, 1] and [0, 17, 0, 3] are good, and the array [2, 4, 6, 7] is bad, because for i=1, the parities of i and a[i] are different: i mod 2 = 1 mod 2 = 1, but a[i] mod 2 = 4 mod 2 = 0.

In one move, you can take any two elements of the array and swap them (these elements are not necessarily adjacent).

Find the minimum number of moves in which you can make the array a good, or say that this is not possible.

Input

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

Each test case starts with a line containing an integer n (1 ≤ n ≤ 40) — the length of the array a.

The next line contains n integers a_0, a_1, …, a_{n-1} (0 ≤ a_i ≤ 1000) — the initial array.

Output

For each test case, output a single integer — the minimum number of moves to make the given array a good, or -1 if this is not possible.

Example

Input


4
4
3 2 7 6
3
3 2 6
1
7
7
4 9 2 1 18 3 0


Output


2
1
-1
0

Note

In the first test case, in the first move, you can swap the elements with indices 0 and 1, and in the second move, you can swap the elements with indices 2 and 3.

In the second test case, in the first move, you need to swap the elements with indices 0 and 1.

In the third test case, you cannot make the array good.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
void mycode();
const long long int mod = 998244353;
long long int ceil(long long int a, long long int b) { return (a + b - 1) / b; }
long long int min(long long int a, long long int b) {
  if (a > b)
    return b;
  else
    return a;
}
bool bit_check(long long int a, int i) {
  if ((a & ((long long)1 << (i - 1)))) return 1;
  return 0;
}
long long int bit_toggle(long long int a, int i) {
  return (a ^ ((long long)1 << (i - 1)));
}
long long int bit_sum(long long int a, int i) {
  return a + ((long long)1 << (i - 1));
}
long long int bit_sub(long long int a, int i) {
  return a - ((long long)1 << (i - 1));
}
long long int mod_power(long long int x, long long int y) {
  long long int p = mod;
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int power_of(long long int a, int b) {
  if (a == 0) return -1;
  return 1 + power_of(a / b, b);
}
long long power(long long int a, long long int b) {
  if (a == 1) return 1;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int main() {
  mycode();
  return 0;
}
void mycode() {
  int t;
  cin >> t;
  while (t--) {
    int n, a = 0, b = 0, k;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> k;
      if ((k & 1) != (i & 1)) {
        if (i & 1)
          a++;
        else
          b++;
      }
    }
    if (a == b)
      cout << a << '\n';
    else
      cout << -1 << '\n';
  }
}

```