//定数倍が軽そうなもの #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include #define rep(i, n) for(i = 0; i < n; i++) using namespace std; int n; int a[70000], ra[70001]; signed main() { int i, j; cin >> n; rep(i, n) cin >> a[i]; rep(i, n) ra[i + 1] = ra[i] + a[i]; assert(1 <= n && n <= 70000); int maxA = a[0], minA = a[0]; rep(i, n) maxA = max(maxA, a[i]); rep(i, n) minA = min(minA, a[i]); assert(maxA <= 50); assert(minA >= 1); long long ans = ((long long)n) * (n - 1) / 2 + 1; for (i = 2; i <= n; i++) { for (j = 0; j + i <= n; j++) { //区間[j, j + i)を確認 if (i * a[j] == ra[j + i] - ra[j]) ans--; else if (i * a[j + i - 1] == ra[j + i] - ra[j]) ans--; } } cout << ans << endl; return 0; }