#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.fr >> a.sc;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.fr << " " << a.sc;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const double PI = acos(-1.0);
const double eps = 1e-9;
const long long int mod = 1e9 + 7;
const long long int inf = 1LL << 30;
const int MAXN = 1e5 + 5;
const int N = 2e5 + 5;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
vector<long long int> adj[200001];
long long int par[200001];
bool vis[200001], on_cycle[200001];
vector<long long int> cycle;
bool is_cycle = false;
long long int res;
void solve() {
  long long int n, i, j, x;
  cin >> n;
  long long int cte = 0;
  long long int cto = 0;
  vector<long long int> a(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i += 2) {
    if (a[i] % 2 == 1) {
      cte++;
    }
  }
  for (i = 1; i < n; i += 2) {
    if (a[i] % 2 == 0) {
      cto++;
    }
  }
  if (cte != cto) {
    cout << -1 << "\n";
  } else {
    cout << cte << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

In CPP, your task is to solve 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;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.fr >> a.sc;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.fr << " " << a.sc;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
const double PI = acos(-1.0);
const double eps = 1e-9;
const long long int mod = 1e9 + 7;
const long long int inf = 1LL << 30;
const int MAXN = 1e5 + 5;
const int N = 2e5 + 5;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
vector<long long int> adj[200001];
long long int par[200001];
bool vis[200001], on_cycle[200001];
vector<long long int> cycle;
bool is_cycle = false;
long long int res;
void solve() {
  long long int n, i, j, x;
  cin >> n;
  long long int cte = 0;
  long long int cto = 0;
  vector<long long int> a(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i += 2) {
    if (a[i] % 2 == 1) {
      cte++;
    }
  }
  for (i = 1; i < n; i += 2) {
    if (a[i] % 2 == 0) {
      cto++;
    }
  }
  if (cte != cto) {
    cout << -1 << "\n";
  } else {
    cout << cte << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

```