#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 17, z = 5;
struct node {
  int a[1 << z], b[1 << z];
} iman[maxn << 2], emp;
node rev(node a) {
  node b = a;
  swap(b.a, b.b);
  return b;
}
int n, q, m, sina[maxn << 2];
node operator+(node a, node b) {
  node ret;
  for (int i = 0; i < 1 << m; i++) ret.a[i] = a.a[b.a[i]];
  for (int i = 0; i < 1 << m; i++) ret.b[i] = a.b[b.b[i]];
  return ret;
}
void arpa(int l = 0, int r = n, int id = 1) {
  if (l + 1 == r) {
    long long x;
    cin >> x;
    for (int k = 0; k < 2; k++) {
      for (int i = 0; i < 1 << m; i++) {
        int y = (x % 2 == 0) || (i != (1 << m) - 1);
        y <<= m;
        y |= i;
        iman[id].a[i] = y >> 1;
      }
      swap(iman[id].a, iman[id].b);
      x ^= 1;
    }
    return;
  }
  int mid = l + r >> 1;
  arpa(l, mid, id << 1);
  arpa(mid, r, id << 1 | 1);
  iman[id] = iman[id << 1] + iman[id << 1 | 1];
}
node val(int id) { return sina[id] ? rev(iman[id]) : iman[id]; }
void majid(int s, int e, int l = 0, int r = n, int id = 1) {
  if (s <= l && r <= e) {
    sina[id] ^= 1;
    return;
  }
  if (e <= l || r <= s) return;
  int mid = l + r >> 1;
  majid(s, e, l, mid, id << 1);
  majid(s, e, mid, r, id << 1 | 1);
  iman[id] = val(id << 1) + val(id << 1 | 1);
}
node hamid(int s, int e, int l = 0, int r = n, int id = 1) {
  if (s <= l && r <= e) return val(id);
  if (e <= l || r <= s) return emp;
  int mid = l + r >> 1;
  node b = hamid(s, e, l, mid, id << 1) + hamid(s, e, mid, r, id << 1 | 1);
  return sina[id] ? rev(b) : b;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> m >> q;
  for (int i = 0; i < 1 << m; i++) emp.a[i] = emp.b[i] = i;
  arpa();
  while (q--) {
    int t, l, r;
    cin >> t >> l >> r;
    l--;
    if (t == 1) {
      long long d;
      cin >> d;
      if (d & 1) majid(l, r);
    } else {
      int w = (hamid(l, r).a[(1 << m) - 1] >> (m - 1));
      cout << (w == 1 ? 1 : 2) << '\n';
    }
  }
}
