#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
const int MOD = 1e9 + 7;
vector<int> take(int n) {
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  return a;
}
template <typename p>
p power(p a, p n) {
  p ans = 1;
  while (n) {
    if (n & 1) ans *= a;
    a = a * a;
    n >>= 1;
  }
  return ans;
}
template <typename p>
p mpower(p a, p n) {
  p ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a) % MOD;
    a = (a * a) % MOD;
    n >>= 1;
  }
  return ans;
}
bool solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (n & 1) {
    for (int i = 0; i < n; i += 2)
      if ((s[i] - '0') & 1) return true;
    return false;
  } else {
    for (int i = 1; i < n; i += 2)
      if ((s[i] - '0') % 2 == 0) return false;
    return true;
    ;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve() ? cout << 1 << endl : cout << 2 << endl;
  }
}
