#include #include using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a%b); } int main() { int n; cin >> n; ll a[n]; for(int i=0;i> a[i]; } map mp[n]; mp[0][a[0]] = 1; ll ans = ((a[0] == 1) ? 1 : 0); for(int i=1;ifirst, a[i])] += itr->second; } } ans += mp[i][1]; } cout << ans << endl; }