1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <climits>
using namespace std;
void input(int &n, vector<int> &arr, int &max_val) {
  int x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    max_val = max(max_val, x);
    arr.push_back(x);
  }
  sort(arr.begin(), arr.end());
}
long long solve (int &n, vector<int> &arr, int &p, int &max_val) {
  vector<long long> dp(max_val + 1, 0), dp2(max_val + 1, 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= max_val; j++) dp2[j] = 0;
    for (int j = arr[i] - 1; j <= max_val; j++) dp2[min(j + arr[i], max_val)] += dp[j];
    if (arr[i] == 1) dp2[1]++;
    for (int j = 0; j <= max_val; j++) dp[j] = (dp[j] + dp2[j]) % p;
  }
  long long result = 0;
  for (int i = 1; i <= max_val; i++) result = (result + dp[i]) % p;
  return result;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, p = 1000000007, max_val = 0;
  vector<int> arr;
  input(n, arr, max_val);
  cout << solve(n, arr, p, max_val) << "\n";
  return 0;
}