fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n; cin >> n;
  7. vector<int> a(n);
  8. for(int i=0;i<n;++i) {
  9. cin >> a[i];
  10. }
  11. int x=1;
  12. for(int i=n-2; i>=0; --i) {
  13. if(a[i+1]>a[i]) ++x;
  14. else break;
  15. }
  16. cout << n - x << "\n";
  17. return 0;
  18. }
Success #stdin #stdout 0s 5280KB
stdin
4
1 2 4 3
stdout
3