Welcome! Please use code tags when posting code.
When you submit code to the judge, EVERYTHING that you output is considered for the answer. This line of code alone will fail your solution:
cout <<"the output is :- "<<"\n";
Once you have solved that you will then likely get a Runtime Error (SIGSEGV).
Nowhere in the problem statement does it say how many numbers there are in the input. There might be 2, there might be 100, there might be 1000000000. Because this is unknown you cannot store the input in memory. Also, the first number in the input is not the number of inputs to follow (n).
The information above makes this incorrect.
int a[10], n=5, c;
cin >>n;
for(c=0;c<n;c++)
{
cin >>a[c];
}
Please post back if you still have questions.