#include #define rep(i,n) for(int i = 0; i < (int)(n); i++) using namespace std; using LL = long long; using P = pair; using vv = vector>; const int INF = (int)1e9; const LL LINF = (LL)1e18; int main(){ int N; cin >> N; vector A(N); rep(i,N) cin >> A[i]; vector B = A; sort(B.begin(), B.end()); B.erase(unique(B.begin(), B.end()), B.end()); int siz = B.size(); vector C = A; sort(C.begin(), C.end()); if(C == A){ cout << siz << endl; return 0; } sort(C.begin(), C.end(), greater()); if(C == A){ cout << siz << endl; return 0; } int ans = 0; rep(i,N){ int a = A[i]; if(a == 0) continue; ans++; for(int j = i; j < N; j++){ if(A[j] >= a) A[j] -= a; } } cout << ans << endl; return 0; }