#include #include #define rep(i,n) for(int i=0;i vi; typedef vector vl; typedef vector> vvi; typedef vector> vvl; typedef long double ld; typedef pair P; template ostream& operator<<(ostream& os, const static_modint& a) {os << a.val(); return os;} template ostream& operator<<(ostream& os, const dynamic_modint& a) {os << a.val(); return os;} template istream& operator>>(istream& is, static_modint& a) {long long x; is >> x; a = x; return is;} template istream& operator>>(istream& is, dynamic_modint& a) {long long x; is >> x; a = x; return is;} template istream& operator>>(istream& is, vector& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;} template ostream& operator<<(ostream& os, const pair& p){os << p.first << ' ' << p.second; return os;} template ostream& operator<<(ostream& os, const vector& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const vector>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} template ostream& operator<<(ostream& os, const set& se){for(T x : se) os << x << " "; os << "\n"; return os;} template ostream& operator<<(ostream& os, const unordered_set& se){for(T x : se) os << x << " "; os << "\n"; return os;} template ostream& operator<<(ostream& os, const atcoder::segtree& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const atcoder::lazy_segtree& seg){int n = seg.max_right(0, [](S){return true;}); rep(i, n) os << seg.get(i) << (i == n - 1 ? "\n" : " "); return os;} template void chmin(T& a, T b){a = min(a, b);} template void chmax(T& a, T b){a = max(a, b);} const int M = 30; struct Rational{ long long p, q; Rational(long long _p, long long _q = 1){ assert(_q != 0); long long g = gcd(_p, _q); _p /= g; _q /= g; if(_q < 0){_p *= -1; _q *= -1;} p = _p; q = _q; } }; // O(N^3 log N) int main(){ int n; cin >> n; vector a(n); cin >> a; auto hash = [&](Rational r){ return r.p * 1001001001 + r.q; }; set> se; rep(l, n){ for(int r = l; r < n; r++){ long long sum = 0; for(int i = l; i <= r; i++) sum += a[i]; vector b; for(int i = 0; i < l; i++) b.emplace_back(a[i], 1); for(int i = l; i <= r; i++) b.emplace_back(sum, r - l + 1); for(int i = r + 1; i < n; i++) b.emplace_back(a[i], 1); vector b_hash(n); rep(i, n) b_hash[i] = hash(b[i]); se.insert(b_hash); } } cout << se.size() << "\n"; return 0; }