Language: C++

n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      | ^
a.cc:1:23: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                       ^~~~
a.cc: In function 'int main()':
a.cc:1:44: error: 'n' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                                            ^
a.cc:1:31: error: 'scanf' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                               ^~~~~
a.cc:1:90: error: 'a' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                                                                                          ^
a.cc:1:104: error: 'ans' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                                                                                                        ^~~
a.cc:1:112: error: 'f' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                                                                                                                ^
a.cc:1:125: error: 'f' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                                                                                                                             ^
a.cc:1:147: error: 'ans' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                                                                                                                                                   ^~~
a.cc:1:132: error: 'printf' was not declared in this scope
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}
      |                                                                                                                                    ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | n, ans = 0, f = 0, a; main() {scanf("%d", &n);for(int i = 1; i <= n; i ++) {scanf("%d", &a);if(a == i) ans += (f ^= 1);else f = 0;}printf("%d\n", ans);}