#include <iostream>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int T;
cin >> T;
while (T--) {
long long num;
cin >> num;
if (num % 10) cout << "0\n";
else cout << "1\n";
}
return 0;
}