#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
const int INF=0x3f3f3f3f;
typedef long long LL;
//根据基站的辐射范围的左边是非递减的,知道
//r的取值有四种情况
/*1. 1 2 3 4 5以1的间隔递增
2. 2 2 2 2 2想同
3. 10 8 7 5递减
4.三种情况混合使用
所以说有时i覆盖的基站j,一定被i前一个基站所覆盖,那么好了只要去掉i和i前一个,
i覆盖的就是k的个数
*/
int main()
{
int t;
scanf("%d",&t);
int kase=0;
while(t--)
{
int ans=0;
int n;
scanf("%d",&n);
int x;
for(int i=1;i<=n;i++)
{
scanf("%d",&x);
if(i>2&&x>2)
ans=ans^(x-2);
}
printf("Case %d: %d\n",++kase,ans);
}
return 0;
}