Oh thanks, I didn't realize you could do it like this:
int n;
scanf("%d", &n);
int a[n];
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
I was expecting scanf to always read a single input line, ie. a string followed by return. This is really neat.