#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class IncreasingSubsequences { public:
	long long count(vector <int> a) 
	{
		a.insert(a.begin(), -1);

		int N = a.size();

		vector< vector<int> > next(N);
		for(int i=0; i<N; ++i) {
			int L = a[i]+1;
			int R = INT_MAX;
			for(int j=i+1; j<N; ++j)
				if( L<=a[j] && a[j]<=R ) {
					next[i].push_back(j);
					R = a[j];
				}
		}

		vector<LL> num(N);
		for(int i=N-1; i>=0; --i) {
			if( next[i].size() == 0 )
				num[i] = 1;
			else
				for(int j=0; j<next[i].size(); ++j)
					num[i] += num[next[i][j]];
		}
		return num[0];
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const long long& Expected, const long long& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, IncreasingSubsequences().count(a));}
int main(){

CASE(0)
	int a_[] = {1,3,2,6,4,5};
	  vector <int> a(a_, a_+sizeof(a_)/sizeof(*a_)); 
	long long _ = 4LL; 
END
CASE(1)
	int a_[] = {1000000000,100000000,10000000,1000000,100000,10000,1000,100,10,1};
	  vector <int> a(a_, a_+sizeof(a_)/sizeof(*a_)); 
	long long _ = 10LL; 
END
CASE(2)
	int a_[] = {1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000};
	  vector <int> a(a_, a_+sizeof(a_)/sizeof(*a_)); 
	long long _ = 1LL; 
END
CASE(3)
	int a_[] = {564,234,34,4365,424,2234,306,21,934,592,195,2395,2396,29345,13295423,23945,2};
	  vector <int> a(a_, a_+sizeof(a_)/sizeof(*a_)); 
	long long _ = 41LL; 
END
CASE(4)
	int a_[] = {1};
	  vector <int> a(a_, a_+sizeof(a_)/sizeof(*a_)); 
	long long _ = 1LL; 
END
CASE(5)
	int a_[] = {5,4,3,2,1};
	  vector <int> a(a_, a_+sizeof(a_)/sizeof(*a_)); 
	long long _ = 5LL; 
END

}
// END CUT HERE
