#include <vector>
#include <iostream>
using namespace std;
class Solution {
public:
int findNumberOfLIS(vector<int>& nums) {
pair<int, int> result(1, 0);
vector<pair<int, int>> count(nums.size(), pair<int, int>(1, 1));
for (int i = 0; i < nums.size(); ++i)
{
for (int j = 0; j < i; ++j) {
if (nums[j] < nums[i] && count[j].first + 1 >= count[i].first) {
if (count[i].first == count[j].first + 1) {
count[i].second += count[j].second;
}
else {
count[i].first = count[j].first + 1;
count[i].second = count[j].second;
}
}
}
if (result.first < count[i].first) {
result.first = count[i].first;
result.second = count[i].second;
}
else if (result.first == count[i].first)
result.second += count[i].second;
}
return result.second;
}
};