#include #include #include #include using namespace std; using ll = long long; int main(void){ int n; cin >> n; vector a(n); for(auto&x:a) cin >> x; int ans=-1, sum=0; auto judge=[&](int x){ int c=0, now=0; for(int i=0; ix) return -1; if(now==x) c++, now=0; } if(now) return -1; return c; }; for(int i=0; i