You are on page 1of 1

#include <iostream>

#include <fstream>
using namespace std;
ifstream f("numere.in");
int main()
{
int nr=0, n;
int x;
f>>n;
f>>x;
int y=x;
nr=nr+(n-x);
while(!f.eof())
{
f>>x;
if(x!=y)
nr=nr+(y-x-1);
y=x;
}
nr=nr+(x-1);
if(nr!=0)
cout<<nr;
else
cout<<"NU";
return 0;
}

You might also like