/*
 * Kamil Debowski
 * For every prefix we update the canonical representation and run O(n) dynamic programming.
 * The update uses the map<int,int> at most O(n) times.
 * The total complexity is O(n^2 * log(n)).
 */

#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9 + 7;

map<int,int> t; // the canonical representation of a current prefix

// fix the canonical representation for a new prefix
void fix(int i) { // will be run O(n^2) times in total
	if(t[i] == 0) return;
	assert(t[i] <= 2);
	bool anything_happened = false;
	if(t[i] == 2) {
		anything_happened = true;
		t[i] = 0;
		t[i+1]++;
		if(i == 1) t[i-1]++;
		else if(i >= 2) t[i-2]++;
	}
	if(i >= 1 && t[i-1] && t[i]) {
		anything_happened = true;
		t[i-1]--;
		t[i]--;
		t[i+1]++;
	}
	if(t[i] && t[i+1]) {
		anything_happened = true;
		t[i]--;
		t[i+1]--;
		t[i+2]++;
	}
	if(anything_happened)
		for(int j = max(0, i - 2); j <= i + 2; ++j)
			fix(j);
}

int main() {
	int n;
	scanf("%d", &n);
	while(n--) {
		int ai;
		scanf("%d", &ai);
		--ai;
		++t[ai];
		fix(ai);
		
		vector<int> gather;
		for(pair<int,int> p : t) if(p.second) { // iterating over a map takes O(size)
			assert(p.second == 1);
			if(!gather.empty()) assert(gather.back() + 2 <= p.first);
			gather.push_back(p.first);
		}
		// 'gather' contains the indices of 1's in the canonical representation
		vector<int> holes;
		int last = -1;
		for(int x : gather) {
			holes.push_back(x - last);
			last = x;
		}
		/*
		 * 'holes' contains distances between consecutive 1's
		 * now we run linear DP
		 * dp[A] = dp[can leave the next 1 without a change]
		 */
		vector<int> dp(2);
		dp[1] = 1;
		for(int i = (int) holes.size() - 1; i >= 0; --i) {
			vector<int> new_dp(2);
			if(holes[i] % 2 == 0)
				new_dp[0] = (dp[0] + dp[1]) % mod;
			new_dp[1] = (long long) (dp[0] + dp[1]) * max(0, (holes[i] - 1) / 2) % mod;
			new_dp[1] = (new_dp[1] + dp[1]) % mod;
			dp = new_dp;
		}
		printf("%d\n", dp[1]);
	}
}
