foo.cc: In function 'void add(int)':
foo.cc:31:26: error: 'p' was not declared in this scope
void add(int pos) {++cnt[p[pos]];if (now == p[pos]){while (cnt[++now]);}}
^
foo.cc: In function 'void del(int)':
foo.cc:32:26: error: 'p' was not declared in this scope
void del(int pos) {--cnt[p[pos]];if (cnt[p[pos]] == 0) now = min(now,p[pos]);}
^
foo.cc: In function 'int main()':
foo.cc:35:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
~~~~~^~~~~~~~~~