#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
const int N = 1010, M = 1e5 + 10, MOD = 1e9 + 7;
int n;
int a[N];
int f[N]; //f[i] = a[0] ~ a[i] 方案数
bool st[M];
vector<int> factor[M];
void get_factor(vector<int> *factor, int m)
{
for (int i = 1; i < m; i++)
{
for (int j = i * 2; j < m; j += i)
factor[j].push_back(i);
}
}
int get_sum(int *a, int index)
{
//printf("\nindex:%d\n", index);
memset(st, 0, sizeof(st));
if (0 == index) return 1;
long long res = 0;
for (int i = index - 1; i >= 0; i--) {
int d = a[index] - a[i], cnt = 0;
for (auto k : factor[d])
{
if (!st[k])
{
//printf("k:%d\n", k);
cnt++;
st[k] = true;
}
}
st[d] = true;
res += ((long long)f[i] * cnt % MOD);
res %= MOD;
//printf("res:%d\n", res);
}
return (int)(res % MOD);
}
int main() {
get_factor(factor, M);
//return 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
scanf("%d", a + i);
f[i] = get_sum(a, i) % MOD;
//printf("f_%d:%d\n",i, f[i]);
}
printf("%d\n", f[n - 1]);
return 0;
}
csp校门外的树