Bear Limak likes watching sports on TV. He is going to watch a game today. The game lasts 90 minutes and there are no breaks.Each minute can be either interesting or boring. If 15 consecutive minutes are boring then Limak immediately turns TV off.You know that there will be n interesting minutes t1, t2, ..., tn. Your task is to calculate for how many minutes Limak will watch the game.

The first line of the input contains one integer n (1 ≤ n ≤ 90) — the number of interesting minutes. The second line contains n integers t1, t2, ..., tn (1 ≤ t1 < t2 < ... tn ≤ 90), given in the increasing order.

Print the number of minutes Limak will watch the game.

NoteIn the first sample, minutes 21, 22, ..., 35 are all boring and thus Limak will turn TV off immediately after the 35-th minute. So, he would watch the game for 35 minutes.In the second sample, the first 15 minutes are boring.In the third sample, there are no consecutive 15 boring minutes. So, Limak will watch the whole game.

#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int n;
	vector<int> a;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		a.push_back(x);
	}
	int count = a[1];
	int flag = 0;
	for (int i = 1 ; i < n; i++)
	{
		if ((a[i] - a[i-1]) > 15)
		{
			count = a[i-1] + 15;
			flag = 1;
			break;
		}
		else
			count = a[i];
	}
	if (n==1)
	{
		if (a[0] <= 15)
			cout << a[0] + 15;
		else
			cout << 15;
	}
	else
	{
	if (a[0] > 15)
		cout << 15;
	else
	{
		if ((90 - a[n-1] <= 15) && (flag == 0))
			cout << 90;
		else
		if (flag == 0)
		{

			if (a[n-1] + 15 <= 90)
				cout << count + 15;
		}
		else
			cout << count;
	}
	}
	return 0;
}

	#include <iostream>

	using namespace std;
	bool b[91];
	int abs(int a,int b)
	{
	    if(a>b)
	        return (a-b);
	    return (b-a);
	}
	int main()
	{
	    int n,c1=0,nr=0,a;bool ok=1;
	    cin>>n;

	    for(int i=1;i<=n;i++)
	    {
	        cin>>a;
	        if(abs(a,c1)>15&&ok==1)
	        {
	            nr+=15;
	            ok=0;
	        }
	        else if(abs(c1,a)<=15&&ok==1)
	        {
	            ok=1;
	            nr+=abs(c1,a);
	        }
	        c1=a;
	    }if(90-c1<=15&&ok==1)
	    {
	    	nr+=90-c1;
	    	cout<<nr;
	    	return 0;
	    }
	    if(90-c1>=15&&ok==1)
	    {
	    	nr+=15;
	    }

	    cout<<nr;
	    return 0;
	}

#include<bits/stdc++.h>
using namespace std;
int main()
{
     int n,sum=0;
     cin>>n;
     vector<int> a;
     a.push_back(0);
     for(int i=0;i<n;i++)
     {
         int x;
         cin>>x;
         a.push_back(x);
     }
     a.push_back(90);
     for(int i=1;i<a.size();i++)
     {
         if(a[i]-a[i-1]>15)
         {
             break;
         }
         else
            sum=a[i];
     }
     if(sum+15>90)
        cout<<90;
     else
        cout<<sum+15;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int i=0;
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int j=0;j<n;j++)
		cin>>a[j];
	if(a[0]>=16)
		cout<<"15";
	else
	{
		while(a[i+1]-a[i]<=15 && i < n)
		{
			i++;
		}
		int k = a[i]+15;
		if(k>90)
			cout<<"90";
		else
			cout<<k;
	}
	return 0;
}
//ncteho

#include<iostream>
#include<vector>
using namespace std;
void main()
{
	int n;
	vector <int> v;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		v.push_back(a);
	}

		if (v[0] > 15)
		{
			cout << "15"<<endl;
		}
		else
		{
			for (int i = 0; i < v.size(); i++)
			{
				int temp = v[i];
				int temp1 = v[i + 1];
				if (temp == 90)
				{
					cout << "90" << endl;
					break;
				}
				if (temp >= 75)
				{
					cout << "90" << endl;
					break;
				}
				if (temp + 15 < temp1)
				{
					cout << temp+15<< endl;
					break;
				}
			}
		}
}

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
#define fi first
#define se second
long long n,m;
long long sum,cnt,cnt1,mi=1000;
//pair<int,int>a[2222];
int main(){
       int ma=-999;
       int n,m=0,r;
       cin>>n;
       int a;
       for(int i=0;i<n;i++)
       {
           cin>>a;
           if(a-m>15){
            r=m+15;
            if(r<mi)
                mi=r;
           }
           m=a;

       }
       if(mi>90)
       {
           if(90-a<=15)
            cout<<90;
           else
            cout<<a+15;
       }
       else
        cout<<mi;

  }

#include <iostream>
using namespace std;
#include <math.h>

void main(){

	int n;
	cin >> n;
	int *a = new int[n+1];
	a[0] = 0;
	for (int i = 1; i <= n; i++)
		cin >> a[i];

	int d;
	for (int i = 0; i < n; i++){
		d = a[i + 1] - a[i];

		if (d > 15){
			cout << a[i] + 15;
			break;
		}
		if (a[n] < 75 && i==n-1)
			cout << a[i + 1] + 15;
		else if (a[n] >= 75 && i==n-1)
			cout << 90;
	}
	delete a;
}

// 673A.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int x, y = 0, as=90;
	bool f = true;
	while (n--)
	{
		cin >> x;
		if (x - y > 15 && f)
		{
			as = y + 15;
			f = false;
		}
		else
			y = x;
    }
	if (f)
		cout << (x + 15 > 90 ? 90 : x + 15);
	else
	cout << as;
	return 0;
}

#include<stdio.h>
#include<string.h>
int main(){
    int i,n,result=0;
    scanf("%d",&n);
    char a[n-1];
    for(i=0;i<n;i++){
            scanf("%d",&a[i]);}
        for(i=0;i<n;i++){
        if(a[i]-a[i-1]>15){
        result=a[i-1]+15;
        break;}
    }
    if(n==1)result=a[0]+15;
    if(a[0]>15)result=15;
    if(result==0){
        if(a[n-1]>=75)result=90;
        else result=a[n-1]+15;
    }
    printf("%d",result);
    return 0;
}

#include<algorithm>
#include<string.h>
#include<string>
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
	int a[100],n,i;

	while(cin >> n)
	{
		for(i =0;i <n ;i ++)
		{
			cin >> a[i];
		}

		sort(a,a+n);

		int t = 0;

		for(i = 0;i < n;i ++)
		{
			if(t + 15 < a[i])
			{
				t= t + 15;
				break;
			}
			else
			{
				t = a[i];
			}
		}

		if(i == n)
        {
            if(t +15 > 90)
				t = 90;
            else
                t += 15;
        }

		printf("%d\n",t);
	}

	return 0;
}
/*2017-11-10 19:38:25.178*/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    // freopen("input PS1.txt", "r", stdin);

    int n, ans = 0, i;
    cin >> n;
    int ara[n];
    for(i = 0; i < n; i++) cin >> ara[i];
    if(ara[0] <= 15) {
        ans += ara[0];
        for(i = 1; i < n; i++) {
            if(ara[i]-ara[i-1] <= 15) ans += ara[i]-ara[i-1];
            else break;
        }
        ans += 15;
        if(ans > 90) ans = 90;
        cout << ans << endl;
    }
    else {
        cout << "15" << endl;
    }
    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define INF 100000000
using namespace std;

int main()
{

    int n, q, h, flag = 0;
    cin >> n;
    cin >> q;
    int s = q;
    if(q > 15) cout << 15 << endl;
    else if(n == 1)
    {
        if(q < 15) cout << q + 15 << endl;
        else if(q > 15) cout << 15 << endl;
        else cout << 30 << endl;
    }
    else
    {
        for(int i = 1; i < n; i++)
        {
            cin >> h;
            if(h - q > 15)
            {
                flag = 1;
                cout << q + 15 << endl;
                break;
            }
            q = h;
        }
        if(h > 74) h = 90;
        else h += 15;
        if(!flag) cout << h << endl;
    }

    return 0;
}

#include <iostream>
#include<sstream>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,N)        for(int i=0;i<(int)N ;++i)
#define loop(i,N)       for(int i=1;i<(int)N ;++i)
using namespace std;
typedef long long ll;
int n,ans;
int arr[100];
 int main()
{
	cin >> n;
	rep(i, n)cin >> arr[i];
	if (arr[0]>15)
	{
		cout << 15 << endl; return 0;
	}
	rep(i, n)
	{
		if (arr[i] - ans >15&&i!=0)
		{
			cout << ans + 15 << endl; return 0;
		}
		else
			ans = arr[i];
	}
	if ((ans == arr[n - 1] && 90 - ans <= 15) || ans > 90)
		cout << 90 << endl;
	else if ((ans == arr[n - 1] && 90 - ans > 15))
		cout << ans + 15 << endl;
	else
	cout << ans << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a[101];
int main()
{
    int n,i,Ans=0;
    cin>>n;
    a[n+1]=90;
    for(i=1; i<=n; i++) cin>>a[i];
    for(i=1; i<=n+1; i++){
        if(a[i]-a[i-1]>15){
            cout<<a[i-1]+15;
            return 0;
        }
    }
    cout<<90;
    return 0;
}

#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
//	freopen("1.txt","r",stdin);
	int n,a[100];
	cin>>n;
	a[0]=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]-a[i-1]>15){
			cout<<a[i-1]+15<<endl;
			return 0;
		}
	}
	if(90-a[n]>15){
//		cout<<a[n]<<endl;
		cout<<a[n]+15<<endl;
		return 0;
	}
	cout<<90<<endl;
	return 0;
}

#include<iostream>
#include<algorithm>
#include<map>
#include<string>
#include<vector>
using namespace std;
#define fo(a,b) for(int i = a;i<b;i++)
#define ll long long
#define N 50

int main()
{
	int n, st = 0, end;
	cin >> n;
	fo(0, n)
	{
		cin >> end;
		if (end - st > 15)
		{
			return cout << st + 15, 0;
			break;
		}
		st = end;
	}
	if (90 - end > 15)
		cout << end + 15;
	else cout << 90;
	//system("pause");
}

#include<iostream>
using namespace std;
int m,n,t=15;
int main(){
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>n;
        if(n<=t) t=n+15;
        else {
          break;
        }
        if(t>=90){
            cout<<"90";
            return 0;
        }
    }cout<<t;
    return 0;
}

#include<iostream>
#include<algorithm>
#include<math.h>
#include<sstream>
#include<set>

using namespace std;

void solve(){
	int n;
	cin>>n;
	int last=0,tmp;
	for(int i=0;i<n;i++){
		cin>>tmp;
		if((tmp-last)>15){
			last+=15;
			cout<<last;
			return;
		}
		last = tmp;

	}
	if(91-last>15)cout<<last+15;
	else cout<<"90";
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

//	int t;
//	cin>>t;
//	while(t--){
		solve();
//	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int a[100];
int b[100];

int main() {
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	int n;
	int k;
	int flag=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		b[i]=a[i]-a[i-1];
	}
	for(int i=1;i<=n;i++){
		if(b[i]>15){
			k=i;
			flag=1;break;}
	}
	if(flag==1) cout<<a[k-1]+15<<endl;
	else {
		if(a[n]+15>90) cout<<"90"<<endl;
		else cout<<a[n]+15<<endl;
	}
	return 0;
}

#include <iostream>
using namespace std;

int main()
{
	//freopen("INPUT.txt","rt",stdin);
	int n, a[100],flag=0;
	cin>>n;
	a[0]=0;

	for (int i=1; i<=n; i++)
	{
		cin>>a[i];
	}
	if (n==1)
	{
		if (a[1]<=15)
			cout<<15+a[1];
		else cout<<15;
		return 0;
	}
	for (int i=0; i<n; i++)
	{
		if (a[i+1]-a[i]>15)
		{
			flag=1;
			cout<<a[i]+15;
			break;
		}
	}
	if (flag==0)
		if (90-a[n]<=15) cout<<90;
		else cout<<a[n]+15;
	return 0;
}

#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
int main()
{
    int watch=0, N, temp;
    vector<int> min;
    cin>>N;
    for(int i=0; i<N; ++i){
        cin>>temp;
        min.push_back(temp);
    }
    for(int i=0; i<N; ++i){
        if(i==0){
            if(min[0]>15) {
                 break;
            }
            else watch+=min[0];
        }
        else{
            if(min[i]-min[i-1]>15){
                break;
            }
            else watch+=min[i]-min[i-1];
        }
    }
    if(watch+15<90) watch+=15;
    else watch=90;
    cout<<watch;
}

#include<bits/stdc++.h>

using namespace std ;

int main()
{
	int n ;
	cin>>n;
	int t[n+1000] ;
	int i ;
	for(i=1;i<=n;i++)
	{
		cin>>t[i] ;
	}
	t[0] = 0 ;
	for(i=1;i<=n;i++)
	{
		if(t[i]-t[i-1]<=15)
		{
			if(t[i]+15<=90)
			{
				if(i==n)
				{
					cout<<t[i]+15 ;
				}
				else
				{
					continue ;
				}
			}
			else
			{
				cout<<90 ;
				break ;
			}
		}
		else
		{
			if(t[i-1]+15<=90)
			{
				cout<<t[i-1]+15 ;
				break ;
			}
			else
			{
				cout<<90 ;
				break ;
			}
		}
	}
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n ;
    cin >> n ;
    int h[n] ;
    for(int i = 0 ; i < n ; i++)cin>>h[i] ;
    if(h[0]>15){cout << 15 ;return 0;}
    for(int i = 0 ; i < n-1 ; i++)if(h[i+1]-h[i]>15){cout<<h[i]+15;return 0;}
    if (n==1){cout << 15 + h[0];return 0;}
    if(90 - h[n-1]>15)cout<< h[n-1]+15;
    else cout << 90 ;
    return 0;
}

#include <iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int i=0;
	int *a = new int[n]; // Выделение памяти для массива
	for (int i = 0; i < n; i++) //заполнение
		cin>>a[i];
	if(a[0]>15)
	{
		cout<<15;
		return 0;
	}
	else

	for (i = 0; i < n-1;i++)

	{
		for (int j = 0; j < n-i-1; j++)

		if(a[j]+15<a[j+1])
		{
			cout<<a[j]+15;
			return 0;
		}

	}

				if(a[n-1]<=90&&a[n-1]>=75)
	cout<<90;

	else
		cout<<a[n-1]+15;

//	system("pause");
return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,a,b;
main(){
cin>>n>>a;
if(a>15){cout<<15;return 0;}
for(int i=1;i<=n-1;i++){
    cin>>b;
    if(b-a>15){cout<<a+15;return 0;}
    a=b;
}
cout<<min(a+15,90);
}

#include<iostream>
#include<vector>

using namespace std;

int main()
{
	int n;
	vector<int> v;
	cin >> n;
	int x;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		v.push_back(x);
	}

	int time = 0;
	int hieu = 0;
	for (int i = 0; i < v.size(); i++)
	{
		if (v[0] > 15)
		{
			time = 15;
			break;
		}
		hieu = v[i + 1] - v[i];
		if (hieu <= 15)
			continue;
		else
		{
			time = v[i]+15;
			break;
		}
	}

	if (time == 0)
		time = v[v.size() - 1]+15;
	if (time > 90)
		time = 90;

	cout << time;

	return 0;
}

#include<iostream>
using namespace std;
int n,i,a[95];
main(){
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]-a[i-1]>15){ break;}}
	cout<<min(a[i-1]+15,90);
}

using namespace std;
#include<iostream>
int main()
{
      int n, arr[90],i,flag=0;
      cin>>n;

      for(i=0;i<n;i++)
      {
          cin>>arr[i];
      }

      if(arr[0]>15)
       {
           cout<<"15";
          flag=1;

       }

      else
       {  for(i=1;i<n;i++)
           { if(arr[i]-arr[i-1]>15&&flag==0)
               {cout<<arr[i-1]+15;
               flag=1;}
           }
       }
   if(arr[n-1]<75&&flag==0)
    {cout<<arr[n-1]+15;
      flag=1;
     }

    if(flag==0)
      cout<<"90";
return 0;

}

//libraries begin
#include<bits/stdc++.h>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<utility>
#include<set>
#include<iterator>
#include <cctype>
//libaries end

//selfddefined macros begin
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define rep1(i, n) for (ll i = 1; i <= ll(n); i++)
#define endl "\n"
#define rsort(a,n) sort(a,a+n,greater<ll>())
#define zen ll t; cin>>t; while(t--)
typedef long long ll;
typedef long double lld;

//selfdefined macros end
void swap(ll &a,ll &b)
{
	ll t=0;
	t=a;
	a=b;
	b=t;
}

ll sumdigits(ll n)
{
	ll p;
	ll s=0;
	while(n>0)
	{
		p=n%10;
		s=s+p;
	}
	return s;
}

ll prime(ll n)
{
	ll c=0;
	for(ll i=2;i<=n/2;i++)
	{
		if(n%i==0){
			c++;
		}
	}
	if(c==0)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

using namespace std;
const ll N=1e5;

int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif

	fio;

//	zen

	int n;
	cin>>n;
	ll a[n];

	rep(i,n) cin>>a[i];

	if(a[0]>15)
	{
		cout<<15;
		return 0;
	}
	if(n==1 && a[0]<=15)
		{cout<<a[0]+15;return 0;}
	int flag=0;
	rep(i,n-1)
	if(a[i+1]-a[i]>15)
	{
		cout<<a[i]+15<<endl;
		flag=1;
		break;
	}
	if(!flag)
		if(a[n-1]+15>90)
			cout<<90;
		else
			cout<<a[n-1]+15;

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    int n;
    int t[91];
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> t[i];
    }

    if (t[0] > 15){
        cout << 15;
        exit(0);
    }
    for (int i = 0; i < n - 1; i++){
        if (t[i + 1] - t[i] <= 15)
            continue;
        else{
            cout << t[i] + 15;
            exit(0);
        }
    }
    if (t[n - 1] + 15 < 90){
        cout << t[n - 1] + 15;
    }
    else if (n < 2)
        cout << t[0] + 15;
    else
        cout << 90;
    return 14 / 88;
}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

ll n, x, y;
vector< ll > v;
int main()
{
    ios_base::sync_with_stdio(0);
    cin >> n;
    if ( n == 1 )
    {
        cin >> x;
        if ( x > 15 )
        {
            cout << 15;
            return 0;
        }
        cout << x + 15;
        return 0;
    }
    for ( int i = 1; i <= n; i ++ )
    {
        cin >> x;
        if ( i == 1 and x > 15 )
            {
                cout << 15;
                return 0;
            }
        if ( i >= 2 )
        {
            if ( x - y > 15 )
            {
                    cout << y + 15;
                    return 0;
            }
        }
        y = x;
    }
    if ( x + 15 >= 90 )
        cout << 90;
    else
        cout << x + 15;
}

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> arr(n);
    for(int arr_i = 0; arr_i < n; arr_i++){
       cin >> arr[arr_i];
    }

    if (n == 1 && arr[0] <= 15) {
        cout << arr[0] + 15 << endl;
        return 0;
    }

    if (arr[0] > 15) {
        cout << 15 << endl;
        return 0;
    }

    for(int i = 0; i < n - 1; i ++){
       if (arr[i + 1] - arr[i] > 15) {
           cout << arr[i] + 15 << endl;
           return 0;
       }
    }

    if (arr[n-1] + 15 < 90) {
        cout << arr[n-1] + 15 << endl;
        return 0;
    }
    cout << 90 << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
   // cout << "Hello world!" << endl;
   int t;
   cin>>t;
   int a[t+1];
   for(int i=0;i<t;i++)
    cin>>a[i];
    if(t==1)
    {
        if((a[0]-1)>=15)
        {
            cout<<"15"<<endl;
        }
        else
        cout<<a[0]+15<<endl;
        return 0;
    }
   if((a[0]-1)>=15)
   {
       cout<<"15"<<endl;
       return 0;
   }
   else
   {

       for(int i=1;i<t;i++)
       {
           if(a[i]-a[i-1]>15)
           {
               if(a[i-1]+15<=90)
               cout<<a[i-1]+15<<endl;
               else
                cout<<"90"<<endl;
               return 0;
           }
       }
       if(90-a[t-1]>15)
       {
           cout<<a[t-1]+15<<endl;
           return 0;

       }
       cout<<"90"<<endl;

   }
    return 0;
}

//libraries begin
#include<bits/stdc++.h>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<utility>
#include<set>
#include<iterator>
#include <cctype>
//libaries end

//selfddefined macros begin
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define s_s stable_sort
#define endl "\n"
#define bs(a,x) binary_search(a.begin(),a.end(),x)
#define pb push_back
#define tarz int t; cin>>t; while(t--)
#define int long long
typedef unsigned long long ull;
typedef long long ll;
typedef long double lld;
//selfdefined macros end

using namespace std;
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
bool isPrime(int n){
    if(n < 2)
        return false;
    if(n < 4)
        return true;
    if(n % 2 == 0 or n % 3 == 0)
        return false;
    for(int i = 5; i*i <= n; i += 6)
        if(n % i == 0 or n % (i+2) == 0)
            return false;
    return true;
}

/*getting all factors of x
  for(int i=1 ; i*i<=x ; i++){
	        if(x%i == 0){
	            v.push_back(i);
	            if(i*i != x)
	                v.push_back(x/i);
	        }
	    }*/
void swap(int &a,int &b)
{
    int t=a;
    a=b;
    b=t;
}

int sumdigits(int x)
{
    int sum=0;
    while(x)
    {
        int t=x%10;
        sum+=t;
        x/=10;
    }
    return sum;
}

bool norep(int x)
{
    map<int,int> m;
    while(x)
    {
        int t=x%10;
        m[t]++;
        if(m[t]>1)
        return false;
        x/=10;
    }
    return true;
}

const int N=90;
int32_t main()
{
    fio;
//   tarz
int n,a[N+2];
cin>>n;
a[0]=0;
for1(i,n) cin>>a[i];
a[n+1]=90;
for1(i,n+1)
{
    if(a[i]-a[i-1]>15)
    {cout<<a[i-1]+15;
    return 0;}
}

cout<<90;
return 0;
}

#include <iostream>

using namespace std;

int n=0;
int m=0;
int a=0;
int i=0;
bool t=true;

int main ()
{
    cin >> n;
    for (i=1; i<=n; i++)
    {
        cin >> a;
        if (m+15<a)
        {
            t=false;
            break;
        }
        m = a;
    }

    if ((t==true)&& (m+15>=90)) { cout << 90 ;}
    else {cout << m+15; }
}

#include<iostream>
#include <vector>

using namespace std;
vector<int> interestingTime;
int main(int argc, char **argv)
{
	int n, minute, next, current;

	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		cin >> minute;
		interestingTime.push_back(minute);
	}

	if (n == 1)
	{
		if (interestingTime[0] >= 16)
			cout << 15 << endl;
		else if (interestingTime[0] <= 15)
			cout << interestingTime[0] + 15 << endl;

		return 0;
	}

	if (n >= 2)
	{
		if (interestingTime.front() < 30 && interestingTime.front() > 15)
		{
			cout << 15 << endl;
			return 0;
		}
		else
		{
			current = 0;
			for (int i = 0; i < n; ++i)
			{
				next = interestingTime[i];
				if (next - current <= 15)
					current = next;
				else
				{
					cout << current + 15 << endl;
					return 0;
				}
			}
			if (interestingTime[interestingTime.size() - 1] - interestingTime[interestingTime.size() - 2] > 15)
			{
				cout << interestingTime[interestingTime.size() - 2] + 15 << endl;
				return 0;
			}
			if (90 - interestingTime[interestingTime.size() - 1] > 15) {
				cout << interestingTime[interestingTime.size() - 1] + 15 << endl;
				return 0;
			}
		}
	}

	cout << 90 << endl;

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    bool y=false;
    int c,l,r;
    cin>>c;
    l=0;
    for(int i=0;i<c;i++){
        cin>>r;
        if(r-l>15&&y==false){cout<<l+15;y=true;}
        else l=r;
    }
    if(y==false)
    cout<<min(r+15,90);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int checkBoring(vector<int>& t) {
  if(15 < t[0])
    return 15;
  if(t.size() == 1)
    return t[0] + 15;
  for(int i = 1; i < t.size(); i++)
    if(t[i - 1] +15 < t[i])
      return t[i-1]+15;
  if(t[t.size() - 1] + 15 < 90)
    return t[t.size() - 1] + 15;
  return 90;
}
int main() {
  int n;
  cin >> n;
  vector<int> t(n,0);
  for(int i = 0; i < n; i++)
    cin >> t[i];
  cout << checkBoring(t);
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, i; cin>>n; int a[n + 1]; a[0] = 0;
	for(i=1; i<=n; i++)
    {
		cin >> a[i];
		if(a[i] - a[i-1] > 15)
		{
		    break;
		}
    }
	cout << min(a[i-1] + 15, 90);
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int a[100],sum=0,k=1,i,j=90,n;
    cin>>n;
    for(i=1;i<=n;i++)
        {
            cin>>a[i];
        }

        if(a[1]>15) {cout<<15;
        return 0;}

    for(i=1;i<n;i++)
        {
            sum=a[i]+15;
            if(sum<a[i+1])
            {
                k=0;
                break;
            }
            k=1;
        }
        if(k==0) cout<<a[i]+15;
        else if(a[n]<75) cout<<a[n]+15;
        else cout<<j;
        return 0;
}

#include <iostream>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int* arr = new int[n+1];
	arr[n] = 90;
	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	int x = 90;
	for (int i = 0; i < n; i++)
	{
		if (arr[0] > 15)
		{
			cout << 15 << endl;
			return 0;
		}
		else if (arr[i + 1] - arr[i] > 15)
		{
			x = arr[i] + 15;
			break;
		}
	}
	cout << x << endl;
	//system("pause");
	return 0;
}

#include <bits/stdc++.h>
#define SPEED ios::sync_with_stdio(false); cin.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define mo 1000000007
#define INF 1e18
#define eps 0.0000000001
#define stp setprecision(20)
#define endl '\n'
using namespace std;
//mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
int main()
{
    SPEED;
    vi a;
    int n, i ;
    cin >> n ;
    int n2 = n;
    a.push_back(0);
    while(n--)
    {
        int t;
        cin >> t;
        a.push_back(t);
    }
    for (i = 0; i < a.size()-1;i++)
    {

        if (a[i+1] - a[i] > 15 )
        {
            cout << a[i] + 15;
            return (0);
        }
        else if (i == a.size() - 2 )
        {
            if (a[i+1] != 90)
            {   if (a[i+1] + 15 <= 90)
                {cout << a[i+1] + 15;
                return (0);}
                else{
                    cout << 90;
                    return 0;
                }
            }
        }

    }
    cout << 90;

    return (0);
}

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int ara[100],n,i,cnt=0,p;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>ara[i];
    }
    if(ara[0]>15){
        cout<<"15"<<endl;
    }
    else{
        for(i=1;i<n;i++){
            if((ara[i]-ara[i-1])>15){
                p=ara[i-1];
                cnt++;
                break;
            }
        }
        if(cnt==0){
            cout<<min(ara[n-1]+15,90)<<endl;
        }
        else{
            cout<<min(p+15,90)<<endl;
        }
    }
    return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    vector <int> v;
    int n,res,c;
    cin >> n;
    v.push_back(0);
    for (int i=0;i<n;i++)
    {
        cin >> c;
        if (c-v.back()>15)
        {
                res=v.back()+15;
                break;
        }
        v.push_back(c);
    }
    if (90-v.back()>15)
    {
            res = v.back()+15;
    } else res = 90;
    cout << res;
    return 0;
}

#include<iostream>

using namespace std;

int main(){
int counter;
cin>>counter;
int start=0;
int num;
for(int i=0;i<counter;i++){
cin>>num;

if((num-start)>15){
cout<<(start+15);
return 0;
}

start=num;

}
num=90;
if((num-start)>15){
cout<<(start+15);
return 0;

}

cout<<"90";
return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){

int n = 0, x = 0; cin >> n;
int r = 0;
int aux  = 0; cin >> aux;
bool b = false, b2 = true;;

if (aux > 15) b = true;

for (int i = 1; i < n; i++){
cin >> x;
if (x - aux > 15 && b2){
r = aux + 15;
b2 = false;
}

aux = x;
}

if (90 - aux > 15 && b2) r = aux + 15;

if (n == 1 ){
if (aux <= 15) cout << aux + 15 << endl;
else cout << 15 << endl;
}
else{

if (b) cout << 15 << endl;
else{
if (r == 0) cout << 90 << endl;
else cout << r << endl;

}

}

return 0;
}

//2016-05-22 02:37:15.683000
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <queue>
#include <math.h>
#include <map>
#include <set>
using namespace std;

typedef long long INT;
typedef pair<int, int> pii;

int a[100];
int main () {

	int N, i;
	scanf("%d", &N);
	for (i=1; i<=N; i++) scanf("%d", &a[i]);
	a[0]=0;
	for (i=1; i<=N; i++) {
		if(a[i]-a[i-1]>15) break;
	}
	if(i==N+1) printf("%d\n", min(a[i-1]+15, 90));
	else printf("%d\n", min(a[i-1]+15, 90));
	return  0;
}

#include<bits/stdc++.h>

using namespace std;

#define ll long long

int main()
{
	ll i,j,k=0;

	int n;

	cin>>n;

	vector<int>v(n+1);

	v[0] = 0;

	for(i=1; i<=n; i++)
		cin>>v[i];

	for(i=0; i<n; i++)
	{
		if(v[i+1]-v[i] >15)
			break;

		k = v[i+1];
	}

	if(k <=75)
	   k = k+15;
	else
	   k = 90;

	cout<<k<<endl;
	return 0;
}

#include<iostream>
#include<vector>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> v;

	//Nhap
	for (int i = 0; i < n; i++)
	{
		int tam;
		cin >> tam;
		v.push_back(tam);
	}
	v.reserve(n);

	//Kiểm tra
	if (n == 1)
	{
		if (v[0] - 0 > 15)
		{
			cout << 15;
		}
		else
		{
			cout << v[0] + 15;
		}

		//system("pause");
		return 0;
	}
	else
	{
		if (v[0] - 15 > 0)
		{
			cout << 15;
			//system("pause");
			return 0;
		}
	}
	bool kt = false;
	for (int i = 0; i < n-1; i++)
	{

		if (v[i + 1] - v[i] > 15)
		{
			cout << v[i] + 15;
			//system("pause");
			return 0;
		}
	}
	if ( v[n - 1] +15 < 90)
	{
		cout << v[n - 1]+15;
		return 0;
		//system("pause");
	}

	cout << 90;
	//system("pause");

	return 0;
}

#include <iostream>
using namespace std;
int n,i,a[1000],sum,r=0;
int main (){
cin>>n;
    a[0]=0;
    for(i=1;i<n+1;i++){
    cin>>a[i];}
    a[n+1]=90;
    for(i=1;i<n+2;i++){
    sum= a[i]-a[i-1]-15;
    if(sum>0){
        r=a[i-1]+15;

            cout<<r;
            return 0;
    }
}
    cout<<90;
return 0;
}

#include <iostream>
int n, arr[91], i;
int main()
{
	i = 1, arr[0] = 0;
	for (std::cin >> n; i <= n; i++)
		std::cin >> arr[i];
	for (i = 1; i <= n; i++)
	{
		if (arr[i - 1] + 15 < arr[i])
		{
			std::cout << arr[i - 1] + 15;
			return 0;
		}
	}
	std::cout << (arr[n] + 15 < 90 ? arr[n] + 15 : 90);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int n,t[100];
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)cin>>t[i];
    if(t[1]>15){
        cout<<15;
        return 0;
    }
    for(int i=1;i<=n;i++){
        if(t[i]-t[i-1]>15){
            cout<<t[i-1]+15;
            return 0;
        }
    }
    if(t[n]<75){
        cout<<t[n]+15;
        return 0;
    }
    cout<<90;
    return 0;
}

#define push_back pb
#define make_pair mk
#include<bits/stdc++.h>
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<cmath>
#include<map>
#include<algorithm>
#include<string>
#include<string.h>
#include<set>
#include<queue>
#include<stack>
#include<functional>
using std::pair;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<PII,int> PPI;
typedef pair<ll,int> PLI;
const double PI=acos(-1);
const int maxn = 100000 + 10;
const int maxm = 100 + 10;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double dinf=1e20;
using namespace std;
int main()
{
    int n;
    int a[110];
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    a[0]=0;
    for(int i=0;i<n;i++)
    {
        if(a[i+1]-a[i]>15)
        {
            cout<<a[i]+15<<endl;
            return 0;
        }
    }
    cout<<min(a[n]+15,90)<<endl;
}

#include<iostream>
using namespace std;
int main()
{
    int n,pre=0,s=90;
    cin>>n;
    for(int i=0;i<n;++i)
    {
        int temp;
        cin>>temp;
        if((temp-pre)>15)
        {
            s=pre+15;
            break;
        }
        pre=temp;
    }
    if(s==90)
    {
        if((90-pre)>15)
            s=pre+15;
    }
    cout<<s;
}

#include <bits/stdc++.h>
using namespace std;
int a[100];
int main()
{
    int n;
    a[0]=0;
    cin>>n;
    for (int i=1; i<=n; i++) cin>>a[i];
    for (int i=1; i<=n+1; i++)
    {
        if (a[i]-a[i-1]>15)
        {
            cout<<min(90,a[i-1]+15);
            return 0;
        }
    }
    cout<<min(a[n]+15,90);
    return 0;
}

#include<iostream>
using namespace std;
#include<vector>
#include<string>

int main() {
	int n, k;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int tmp = 15;

	for (int i = 0; i < n; i++) {
		if (a[i] > tmp) {

			break;
		}

		else {
			tmp = a[i] + 15;
		}

	}
	if (tmp >= 90) {
		cout << 90 << endl;
	}
	else {
		cout << tmp << endl;
	}

	return 0;
}

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;
int main()
{
	int a[100],i,n;
	int f,j;
	while(scanf("%d",&n)!=EOF)
	{
		f=0;
		j=n-1;
		for(i=0;i<n;i++)
		{
			cin>>a[i];
		}
		for(i=0;i<=n-1;i++)
		{
			if(a[i]>=90)
			{
				j=i;
				break;
			}
		}
		if(a[0]>15)
		{
			cout<<15<<endl;
			continue;
		}
        for(i=1;i<=j;i++)
		{
			if(a[i]>90)
			{
					if(a[i-1]<=75)
		                cout<<a[i-1]+15<<endl;
		            if(a[i-1]>75)
			            cout<<90<<endl;
		            f=1;
				    break;
			}
			if(a[i]-a[i-1]>15&&a[i]<=90)
			{
				if(a[i-1]+15<=90)
				{
					f=1;
					cout<<a[i-1]+15<<endl;
					break;
				}
				else
				{
					f=1;
					cout<<90<<endl;
					break;
				}
			}
		}
		if(f==0&&a[j]<=75)
		    cout<<a[j]+15<<endl;
		if(f==0&&a[j]>75)
			cout<<90<<endl;
	}
	return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
  int n;
  cin >> n;
  int t[n];
  int i;
  int s;
  for(i=0; i<n; i++){
    cin >> t[i];
  }
  int now = 0;
  for(i=0; i<n; i++){
    if(t[i] - now <= 15){
      now = t[i];
      s = now;
      if(i == n-1){
        if( t[i]+15 <= 90){
          s += 15;
        }
      }
    }
    else{
      s = now + 15;
      break;
    }
  }
  if( s == t[n-1]){
    s = min(s+15, 90);
  }
  cout << s;
  return 0;
}

#include <iostream>
using namespace std;

int main()
{
	int n, a[1000], Count = 15;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	a[0] = 0;
	if (a[1] > 15)
		cout << Count << endl;
	else
	{
		for (int i = 1; i <= n; i++)
		{
			if (a[i] <= a[i-1] + 15)
			{
				if (a[i] + 15 >= 90)
				{
					Count = 90;
					break;
				}
				else
				{
					Count = a[i] + 15;
				}
			}
			else
			{
				break;
			}
		}
		cout << Count << endl;
	}
	//system("pause");
	return 0;
}

#include<bits\stdc++.h>
using namespace std;
const int maxn = 1e5+6;
int vis[100];
int main()
{
    int n;
	scanf("%d",&n);
	for (int i = 1;i<=n;i++)
	{
		int temp;
		scanf("%d",&temp);
		vis[temp]=1;
	}
	int now=0;
	int sum=0;
	for (int i = 1;i<=90;i++)
    {
        sum++;
		if(vis[i])
			now=0;
		else
			now++;
		if(now==15)
			break;
    }
	printf("%d\n",sum);
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,a=0;
    cin >> n;
    vector <int> t(n);
    for(int i=0;i<n;i++)
    {
        cin >> t[i];
    }
    if(t[0]>15)
    {
        cout << "15";
    }
    else
    {
        if(n==1)
        {
            cout << t[0]+15;
        }
        else
        {
            for(int i=1;i<n;i++)
            {
                if(t[i]>t[i-1]+15)
                {
                    a=t[i-1]+15;
                    if(a<90)
                    {
                        cout << a;
                        return 0;
                    }
                    else
                    {
                        cout << "90";
                        return 0;
                    }
                }
            }
            if(t[n-1]+15>=90)
            {
                cout << "90";
            }
            else
            {
                cout << t[n-1] + 15;
            }
        }
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int cnt=0;
	int s=0;
	for(int k=1;k<=n;k++){
		int a;
		cin>>a;
		if(a-cnt>15){
		cout<<s+15;
		return 0;
	}
	    else s+=a-cnt;
		cnt=a;
	}
	if(90-s<=15) cout<<90;
	else cout<<s+15;
	return 0;
}

//673A
#include<iostream>
using namespace std;
int ax, an;
int main() {
	int n;
	cin >> n;
	int a[92];
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	a[0] = 0;
	a[n+1] = 90;
	int size = n + 2;
	for (int i = 1; i < size; i++)
	{
		if (a[i] - a[i - 1]>15) {
			ax = i-1;
			an++;
			break;
		}
	}
	if (an != 0) {
		cout << a[ax] + 15 << endl;
	}
	else
		cout << "90" << endl;
//	system("pause");
	return 0;
}

#include <iostream>
using namespace std;
int main ()
{
    int n;
    cin>>n;
    int x=0;
    for(int i=0;i<n;i++)
    {
	    int a;
	    cin>>a;
	    if(a-x>15)
	    {
	        cout<<x+15<<endl;
	        return 0;
	    }
	    x=a;
    }
    if(x+15<90)
        cout<<x+15;
    else
        cout<<90;
    return 0;
}

#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
	int n;
	while(scanf("%d",&n)!=EOF)
	{
		int i,a[91];
		memset(a,0,sizeof(a));
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
		}
		for(i=1;i<=n;i++)
		{
			if(i!=n)
			{
				if(a[i]-a[i-1]>15)
			{
				printf("%d\n",a[i-1]+15);
				break;
			}
			}
			else{
				if(a[i]-a[i-1]>15)
				printf("%d\n",a[i-1]+15);
				else
				{
					if(a[i]>=75)
					printf("90\n");
					else
					printf("%d\n",a[i]+15);
				}
			}
	}
}
	return 0;
}

#include <iostream>
using namespace std;

int main()
{
    int size,x,current=0,n;
    cin>>size;
    n=size;
    int m[size];
    for(x=0;x<size;x++)
    {
        cin>>m[x];
    }
    if((size==1)&&(m[0]<=15))
    {
        current=m[0]+15;
        cout<<current;
    }
    if(m[0]>15)
        {
            current=15;
            cout<<current;
            return 0;

        }
    for(x=0;x<size;x++)
    {

        if(x+1<size)
        {

            if((m[x+1]-m[x])>15)
            {
                current=m[x]+15;
                cout<<current;
                break;
            }

        }

    }
    if((current==0)&&(m[n-1]!=90))
    {
        if((m[n-1]+15)>=90)
        {
        cout<<m[n-1]+(90-m[n-1]);
        }
        if((m[n-1]+15)<90)
        {
            cout<<m[n-1]+15;
        }
    }
    if((current==0)&&(m[n-1]==90))
    {
        cout<<90;
    }
	return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{

	int n;
	cin >> n;
	vector<int> v;
	vector<int>::iterator it;
	for (int i = 0; i < n; i++)
	{
		int value;
		cin >> value;
		v.push_back(value);
	}

	int totalTime = 0;
	for (int i = 0; i < n; i++)
	{
		int time = v[i];
		if (time <= totalTime + 15)
		{
			totalTime = v[i];
		}
		else
		{
			totalTime += 15;
			break;
		}

		if (i == n - 1)
		{
			totalTime += 15;
		}
	}

	if (totalTime > 90)
	{
		totalTime = 90;
	}

	cout << totalTime<<endl;

	return 0;
}

#include<iostream>
using namespace std;
int n,x[100],ans;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>x[i];
    ans=15;
    for(int i=1;i<n;i++)
        if(x[i]-x[i-1]>15)
        {
            ans=x[i-1]+15;
            break;
        }
        else ans=x[i]+15;
    if(n==1&&x[0]<=15)
        ans=x[0]+15;
    if(x[0]>15)
        ans=15;
    if(ans>90)
    ans=90;
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define     ll           long long
#define     sf(n)        scanf("%lld",&n)
#define     pf(n)        printf("%lld\n",&n)
#define     ct(p)        cout<<p<<endl
#define     mem(a)       memset(a,0,sizeof a)
#define     yes          cout<<"YES"<<endl
#define     no           cout<<"NO"<<endl
ll a[10000000],b[1000000];
map<ll,ll>mp;

///......................................///

int main()
{
    cin.sync_with_stdio(false);
    ll i,j,k,l,c,v,b[1000],aa[1000],bb[10000],n,m,r,t;
    // ll bb[10][10];
    ll x1,x2,y1,y2,x3,x4,x5,x6;
    string s,s1,s2,s3,ss[10000];
    s1="CODEFORCES";

    while(cin>>n)
    {
        v=0;
        l=0;
        for(i=0; i<n; i++)
        {
            cin>>m;
            if(m-v>15&&l==0)
            {

                l=v+15;
            }
            v=m;
        }
        if(l!=0)
            cout<<l<<endl;
        else{
            m=m+15;
            if(m>90)
                m=90;
        cout<<m<<endl;
        }
    }
}

#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	cin>>n;

	int x;
	cin>>x;
	if (x>15)
	{
		cout<<15;
		return 0;
	}

	if (n==1)
	{
		cout<<x+15;
		return 0;
	}

	long long cnt=x;

	int z;

	for (int k=2;k<=n;k++)
	{

		cin>>z;
		if (z-x<=15)
		{
			cnt+=(z-x);
		}
		else
		{
			if (cnt+15>90)
			{
				cout<<90;
				return 0;
			}
			else
			{
				cout<<cnt+15;
				return 0;
			}
		}
		x=z;
	}
	if (cnt>74 && z>74)
	{
	cout<<90;
	return 0;
	}
	if (z<=74 && z==cnt)
	{
	cout<<cnt+15;
	return 0;
	}
	cout<<cnt;
}

#include<bits/stdc++.h>
using namespace std;
int t[105];
int main() {
	int n;
	scanf("%d", &n);
	t[0] = 0;
	for(int i = 1; i <= n; ++i)
		scanf("%d", &t[i]);
	t[n+1] = 91;
	for(int i = 1; i <= n + 1; ++i) {
		if(t[i] > t[i-1] + 15) {
			printf("%d\n", t[i-1] + 15);
			return 0;
		}
	}
	puts("90");
	return 0;
}

#include <cmath>
#include <vector>
#include <iostream>
#include <string>
 using namespace std;
 vector<bool> a(100,0);
 int main()
{
  // ifstream cin("input.txt");
  // ofstream cout("output.txt");
   int n;
   cin >> n;

   for (int i = 0;i <n; i++)
   {
	   int x;
	   cin >> x;
	   a[x] = true;
   }
   int c = 0;
   for (int i = 1; i<=90; i++)
   {
	   if (a[i])
		   c=0;
	   else
		   c++;
	   if (c==15)
	   {
		   cout << i;
		   return 0;
	   }
   }
   cout << 90;
   return 0;
 }

#include<iostream>
#include<vector>

using namespace std;

int main()
{
	int n=0;
	vector<int> v;
	cin >> n;
	int x=0;
	for (int i = 0; i < n; i++)
	{
		cin >> x;
		v.push_back(x);
	}

	int time = 0;
	int hieu = 0;
	for (int i = 0; i < v.size(); i++)
	{
		if (v[0] > 15)
		{
			time = 15;
			break;
		}
		hieu = v[i + 1] - v[i];
		if (hieu <= 15)
			continue;
		else
		{
			time = v[i]+15;
			break;
		}
	}

	if (time == 0)
		time = v[v.size() - 1]+15;
	if (time > 90)
		time = 90;

	cout << time;

	return 0;
}

#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define fr first
#define sc second
#define r_0 return 0

using namespace std;

    ll x, y, mn, mx, mnp, mxp;
    vector<int>v;

int main()

{
    cin >> x;

    for ( int i = 0; i < x; i ++ ){
        cin >> y;
        v.pb(y);
    }

    if ( v[0] - 15 > 0 ){
        cout << "15";
        r_0;
    }else if ( x == 1 ){
        cout << 15 + v[0];
        r_0;
    }

    for ( int i = 1; i < v.size(); i ++ ){
        if ( v[i] - v[i-1] > 15 ){
            cout << v[i-1] + 15;
            r_0;
        }
    }

    if ( 90 - v[x-1] < 15 ){
        cout << "90";
        r_0;
    }

    cout << v[x-1] + 15;

    r_0;
}

#include<iostream>
using namespace std;
#include<vector>
#include<string>

int main() {
	int n, k;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int tmp = 15;

	for (int i = 0; i < n; i++) {
		if (a[i] > tmp) {

			break;
		}

		else {
			tmp = a[i] + 15;
		}

	}
	if (tmp >= 90) {
		cout << 90 << endl;
	}
	else {
		cout << tmp << endl;
	}

	return 0;
}

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n;
    cin>>n;
    int cnt=0;
    vi v(n,0); rep(i,n)cin>>v[i];
    rep(i,n){
        if(!i){
            if(v[0]<=15)
                cnt+=v[0];
            else{
                break;
            }
        }
            if(v[i]-cnt>15){
                break;
            }else
                cnt=v[i];
    }
    cout<<(cnt+15>90 ? 90:cnt+15)<<endl;
}

#include <iostream>
#include <vector>
using namespace std;

int main(){
	int size;
	int min;
	int time = 0;
	vector <int> arr;
	cin >> size;
	for(int k = 0; k<size; k++){
	    cin >> min;
	    arr.push_back(min);
	}

	for(int i =0; i<size; i++){
	    if(time + 15 >= arr[i]){
	        time = arr[i];
	    }
	    else break;
	}

	if (time +15 < 90) cout << time + 15;
	else cout<<"90";

	return 0;
}

#include <iostream>

using namespace std;

int a, b[100], ans;

int main()
{
	cin >> a;

	for(int i=1; i <= a; i++)
		cin >> b[i];

	if(b[1] > 15) {
		cout << 15;
		return 0;
	}
	if(b[1] <= 15) {
		ans = b[1];

		for(int i=2; i <= a; i++) {
			if(ans + 15 < b[i]) {
				cout << ans+15;
				return 0;
			}
			if(ans + 15 >= b[i])
				ans = b[i];
		}
	}
	if(ans + 15 >= 90)
		cout << 90;
	else
		cout << ans+15;
}

#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int>v;
int n;cin>>n;
int x;

for(int i=0;i<n;i++)
{
cin>>x;
v.push_back(x);
}
if(v[0]>15)
	cout<<15<<endl;
else
{
	bool is=true;
	for(int i=0;i<v.size()-1;i++)
	{
		if(v[i+1]<=v[i]+15)
			continue;
		else
		{
			is=false;
			cout<<v[i]+15<<endl;
			break;

		}
	}

	if(is)
	{
		if(v[n-1]+15<90)
			cout<<v[n-1]+15<<endl;
		else
		cout<<90<<endl;

	}
}

return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c=0,d=0,m,i,n,j,p,t=0,k,array[100000+10],ar[100000],q=90,sum1=0,cnt=INT_MIN,sum=0,flag,ans,f=0,l;
    long long int st,ct,qt;
    string str,ptr,sp[5000];
    set<pair<long long int,long long int>>vecs;
    vector<long long int>vi(100000,0);
    stack<long long int>stck;
    vector<char>vc;
    cin>>n;
    array[0]=0;
    for(i=1; i<=n; i++)
    {
        cin>>array[i];
    }
    array[n+1]=90;
    for(i=1; i<=n+1; i++)
    {
        if(array[i]-array[i-1]>15)
        {
            f=f+array[i-1];
            cout<<f+15<<endl;
            return 0;
        }

    }
    cout<<90<<endl;

}

#include <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <cstring>
#include <string>
using namespace std;

#define loop(_i, _n) for( _i = 0; _i < _n; _i++)
#define loopi(_i, _n, _s) for( _i = _s; _i < _n; _i++)

int main()
{
#ifndef ONLINE_JUDGE
	freopen("D:\\in.txt", "r", stdin);
#endif

	int i, n, res, l, v;

	cin >> n;
	l = 0;

	loop(i, n)
	{
		cin >> v;
		if (v - l > 15)
		{
			res = l + 15;
			break;
		}
		res = v;
		l = v;
	}

	if (i == n)
		res = min(res + 15, 90);

	cout << res;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){
	int n, val;
	int aux=0;
	cin >> n;
	int v[200];
	v[0]=0;
	for (int i = 1; i <= n; i++)
	{
		cin >> v[i];
	}
	int i;
	for (i = 1; i <= n; i++)
	{

		if(v[i]-v[i-1]>15){
			//aux=v[i-1];
			break;
		}else aux=v[i];

	}
	if(i==n+1){
		if(aux+15 >= 90) cout << 90 << endl;
		else cout << aux+15 << endl;

	}else cout << aux+15 << endl;

	//cout << aux << endl;

    return 0;
}

#include<iostream>
#include<vector>
#include<cstdio>
using namespace std;

//http://codeforces.com/problemset/problem/673/A
main(){
    //freopen("D:\\BigOCoding\\input.txt", "r", stdin);
    vector<int> a;
    int n;
    cin >> n;
    a.resize(n);
    for (int i = 0; i < a.size(); i++) {
        cin >> a[i];
    }

    if(a[0]>15){
        cout<< 15;
        return 0;
    }

    for (int i = 0; i < a.size() - 1; i++){
        if(a[i+1]> a[i]+15){
            cout<< a[i]+15;
            return 0;
        }
    }

    if (a.back() + 15 < 90) cout << a.back() + 15;
    else cout<< 90;

    return 0;
}

#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <ctime>
#include <sstream>

using namespace std;

int main(){
#ifdef TEST
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	scanf("%d", &n);
	n += 2;
	vector<int> t(n);
	for (int i = 1; i < n - 1; i++)
		scanf("%d", &t[i]);
	int time = t[0] = 0;
	t[n - 1] = 90;
	for (int i = 0; i < n - 1; i++){
		if (t[i + 1] - t[i] <= 15)
			time = t[i + 1];
		else{
			time += 15;
			break;
		}
	}
	printf("%d", time);
	return 0;
}

//http://codeforces.com/problemset/problem/673/A
#include <iostream>

using namespace std;

int main()
{
    short n;
    int y;
    int count=0,count1=0;
    short a[90+5];
    cin>>n;
    for(int y=0;y<n;y++ )
        cin>>a[y];

        if(n==0)
            count=15;
        if(n==1)
        {
            if(a[0]>15 )
            count= 15;
            else
                count=a[0]+15;
        }

    else if(n>1)
    {
         if(a[0]>15 )
            count= 15;
            else
            count=a[0];

        if(a[0]<=15)
        {

        for(y=1;y<n;y++)
        {
            if(a[y]-a[y-1]<=15)
                {
                    count=a[y];
                }
            else
                {
                count+=15;
                break;
                }
        }
        if(y==n)
            count+=15;
        }
    }
    if(count>90)
        cout<<"90";
    else
    cout<<count;

    return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <iterator>
#include <stack>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int *t = new int[n];
	int last = 0;
	cin >> t[0];
	if(t[0] >= 16)
	{
		cout << 15 << endl;
		return 0;
	}
	last = t[0];
	for (int i = 1; i < n; i++)
	{
		cin >> t[i];
		if(t[i] - last > 15)
		{

			cout << last+15 << endl;
			return 0;
		}
		last = t[i];
	}
	cout << min(last+15, 90) << endl;
	return 0;
}

#include <iostream>
#include<string.h>

using namespace std;

int main()
{
    bool chk[99];
    memset(chk,false,sizeof(chk));

    int n,t;
    cin>>n;
    for(int i=0; i<n; i++)
    {
     cin>>t;
     chk[t]=true;
    }
    int ctr = 0;
    for(int i=1; i<=90; i++)
    {
       if(chk[i]==true) ctr=0;
       else if(!chk[i]) ctr++;
       //cout<<ctr<<' ';
       if(ctr==15 || i==90) { cout<<i<<'\n'; break; }
    }
    return 0;
}

#include<iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int A[n+10];
    A[0]=0;
    int ans;
    for(int i=1; i<=n; i++)
    {
        cin >> A[i];
    }
    A[n+1]=90;
    for(int i=0; i<n+2; i++)
    {
        if(A[i+1]-A[i]>15)
        {
            ans=A[i]+15;
            break;
        }
    }
    if(ans>90 or ans==0)
    {
        ans=90;
    }
    cout << ans;
}

#define push_back pb
#define make_pair mk
#include<bits/stdc++.h>
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<cmath>
#include<map>
#include<algorithm>
#include<string>
#include<string.h>
#include<set>
#include<queue>
#include<stack>
#include<functional>
using std::pair;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<PII,int> PPI;
typedef pair<ll,int> PLI;
const double PI=acos(-1);
const int maxn = 100000 + 10;
const int maxm = 100 + 10;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f;
const double dinf=1e20;
using namespace std;
int main()
{
    int n;
    int a[100];
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    int res=0;
    a[0]=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]-a[i-1]>15)
        {
            cout<<a[i-1]+15<<endl;
            return 0;
        }
    }
    cout<<min(90,a[n]+15)<<endl;
}

#include <bits/stdc++.h>
using namespace std;
#define NN 100
int a[NN];
int main () {
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) {
		if(a[i]-a[i-1]>15) {
			printf("%d",a[i-1]+15);
			return 0;
		}
	}
	if(a[n]+15<=90) a[n]+=15;
	else a[n]=90;
	printf("%d",a[n]);
	return 0;
}

#include<algorithm>
#include<string.h>
#include<string>
#include<cstdio>
#include<iostream>

using namespace std;

int main()
{
	int a[100],n,i;

	while(cin >> n)
	{
		for(i =0;i <n ;i ++)
		{
			cin >> a[i];
		}

		sort(a,a+n);

		int t = 0;

		for(i = 0;i < n;i ++)
		{
			if(t + 15 < a[i])
			{
				t= t + 15;
				break;
			}
			else
			{
				t = a[i];
			}
		}

		if(i == n)
        {
            if(t +15 > 90)
				t = 90;
            else
                t += 15;
        }

		printf("%d\n",t);
	}

	return 0;
}
/*2017-11-10 19:38:25.178*/

#include <iostream>

using namespace std;

int main()
{

    int numberOfMinutes ;

    cin>>numberOfMinutes;

    int currentMinute = 0 ;

    int diff;

    int temp ;

    for (int i=0 ; i < numberOfMinutes ; i++ ){

        cin>>temp;

        diff = temp-currentMinute;

        if (diff>15) {

            break;

        }

        else {

            currentMinute=temp;
        }

    }

    currentMinute+=15;

    if (currentMinute>90){
        currentMinute=90;
    }

    cout << currentMinute;

    return 0;
}

#include<iostream>
using namespace std;
#include <vector>

int main()
{
   vector<int> v;
   int n, i;
   int s,d;
   int count=0;
   cin>>n;
   v.resize(n);

   for (i = 0; i < n; ++i)
   {
   		cin >> v[i];
   }
   s = v[0];
   for(i =0; i < n; i++)
   {
   	if( s >15)
   		count = 15;
   	else
   		d = v[i+1] - s;
   	if(d > 15)
   		count = s + 15;
   	else
   		count = v[i+1];
   	s=v[i+1];

 }
   cout<<count;
   return 0;

  }

#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define forn(i,n) for (int i = 0 ; i < n; ++i)

using namespace std;
int n;
void init(){
	scanf("%d", &n);
}

void solve(){
	int prev = 0;
	int ans = 0;
	int flag = 0;
    for (int i = 0;i < n;i++){
    	int x;
    	scanf("%d",&x);
    	if (x - prev > 15){
    	 	ans = prev + 15;
    	 	flag = 1;
    	 	break;
    	}
    	prev = x;
	}
	if (flag == 0) cout << prev;
	else cout << ans;
}

int main(){
	std::ios::sync_with_stdio(false);
	init();
	solve();
 	return 0;
}

#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cctype>
#include <fstream>
#define pf printf
#define sf scanf
#define mod 1000000007
#define inf 1<<30
#define eps 1e-9
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define read(n) sf("%I64d",&n)
#define pi acos(-1)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, n) for(int i = 1; i <= n; ++i)
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
int dxx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
int dyy[] = {0, +1, 0, -1, +1, -1, +1, -1};
using namespace std;
typedef long long ll;
set <ll>::iterator it;
ll bigmod(ll a, ll b)
{
    ll ret = 1LL;

    while(b)
    {
        if(b&1) ret = (ret*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return ret;
}

int main()
{
                                                         ///memset(ar,0,sizeof(ar));
                                                        ///freopen("input.txt","r",stdin);
                                                       ///freopen("output.txt","w",stdout);
                                                      ///ios_base::sync_with_stdio(0);  cin.tie(NULL);
    ///**************************************************************************************************************************************************

    ll n,n1,n2,n3,m,m1,m2,m3,a,b,c,i,j,k,l,l1,l2,t,t1,t2,t3,s,s1,s2,s3,cnt=0,cnt1,cnt2,cnt3,temp,flag;
    ll ar[100];
    while(cin>>n){
    for(i=0;i<n;i++){
        cin>>ar[i];
    }
    sort(ar,ar+n);
    cnt=0;
    if(n==1 && ar[0]<=15){cout<<ar[0]<<endl; return 0;}
    else if(n==1 && ar[0]>15){cout<<"15"<<endl; return 0;}
    else if(ar[0]>15){cout<<"15"<<endl; return 0;}
    else if(ar[0]<=15){cnt=ar[0];}
    for(i=0;i<n-1;i++){
        temp=abs(ar[i+1]-ar[i]);
        if(temp<=15){cnt=ar[i+1];}
        else if(temp>15){cnt=cnt+15;cout<<cnt<<endl;return 0;}
    }
    cout<<cnt<<endl;
    }
    return 0;
}

#include <iostream>

using namespace std;
int n,t=0,t1,out,mmmm;
bool r=true;
int main()
{
    cin>>n;
    int arr[n+1];
    arr[0]=0;
    for (int i=1;i<n+1;i++){
        cin>>arr[i];
    }
    for (int i=0;i<n+1;i++){
       if (arr[i+1]-arr[i]>15){
            out=arr[i]+15;
            r=false;
            break;
       }
    }

    if (r==false)cout<<out<<endl;
    else cout<<"90"<<endl;

    return 0;
}

#define _CRT_SECURE_NO_DEPRECATE
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<memory.h>
#include<map>
#include<set>

using namespace std;
int n, res;

int main()
{
	//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	res = 1;
	if (n == 0)
	{
		res = 0;
		printf("%d", res);
		return 0;
	}
	for (int i = 0; i < n; ++i)
	{
		int b;
		scanf("%d", &b);
		if (b - res >= 15)
		{
			res += 15;
			if (res == 16)
				res = 15;
			printf("%d", res);
			return 0;
		}
		else res = b;
	}
	res = 90;
	printf("%d", res);
	return 0;
}

#include <iostream>

using namespace std;

typedef long long ll;

int main()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll ans = 0, s = 1,a[n];
    for(ll i = 0;i < n;i++)
        {
            cin >> a[i];
            if(i == 0)
                {
                    if(a[0] > 15)
                    {
                        ans = 15;
                        s = 0;
                    }
                    else ans += a[0];
                }
            else
                {
                    if(a[i] - a[i - 1] > 15)
                        {
                            if(s)
                            {
                                ans += 15;
                                s = 0;
                            }
                        }
                    else
                        {
                            if(s)
                                ans += (a[i] - a[i - 1]);
                        }
                }
        }
    cout << ans;
    return 0;
}

#include<bits/stdc++.h>
#define r_0 return 0
#define pb push_back
#define ll long long
#define ld long double
#define fr first
#define se second
#define Time ios_base::sync_with_stdio(0);
#define sz size
using namespace std;
int n, m,x,y,t,ans,res, sum,mn = 1e9,cnt,mx,k,z,mnn = 1e9,mxx,b = 1, i;
string s1,s3,s2,s;
set<ll>st;
pair <ll , ll>p[1000001];
vector<int>v,v1,v3,v4,v2;
map<char, ll>mp , mpp;
char  c,d,e,a;
bool tr = false, fl = false;
int used[10001];
 main()
{
        /*

            cin >> n;
            int a[n];
            for ( int i = 0; i < n; i ++ )
                 cin >> a[i];
                 for( int i = 0; i < n; i ++ )
                 {
                     if ( a[i] < 0 )
                        v.pb ( a[i] );
                     else if ( a[i] > 0 )
                     {
                         x = i;
                         cnt = 0;
                         while( true )
                         {
                             if ( a[x] > 0 )
                                cnt += a[x], a[x] = 0;
                                 if ( a[x] < 0 or x == n - 1 )
                                     break;
                             x ++;
                         }
                         v.pb ( cnt );
                     }
                 }
                 cnt = 0;
                 for ( int i = 0; i < v.size(); i ++ )
                 {
                     cout << v[i] << " ";
                 }
                 r_0;
                    if ( v[i] < 0 )
                    cnt ++;
                    else if ( v[i] > 0 and v[i+1] < 0 )
                     {
                         m = v[i];
                         z = i+1;
                         while( m )
                         {
                             if ( v[z] < 0 )
                                cnt --;
                              if ( v[z] >= 0 )
                                break;
                              z ++;
                             m --;
                         }
                     }

                 if ( cnt < 0 )
                    cout << 0;
                 else
                 cout << cnt;
                   */

                  cin >> n;
                  int a[n];
                  for ( int i = 0; i < n; i ++ )
                    cin >> a[i];
                if ( n == 1 ){
                    if ( n <= 15 )
                        cout << a[0] + 15; r_0; }
                    if ( a[0] > 15 )
                        cout << 15;
                    else {
                  for( int i = 0; i < n - 1; i ++ ){
                       if ( a[i+1] - a[i] > 15  ){
                           sum = a[i] + 15 ; break; }
                  }
                  if ( sum == 0 and 90 - a[n-1] > 15 ){
                    cout << a[n-1] + 15; r_0; }
                    if ( sum == 0  )
                        cout << 90;
                    else
                        cout << sum;
                    }
                 /*
                 cin >> n;
                 int a[n];
                 set < ll > st;
                 map <ll , ll > mp;
                 for ( int i = 1; i <= n; i ++ )
                 {
                     cin >> a[i];
                     st.insert( a[i] );
                 }
                 if ( st.size() == 3 )
                 {

                 }
                 else cout << 0;
                    */

           /*
           vector<char>v;
         char a[]= "Bulbasaur";
         cin >> s;
         for ( int i = 0; i < 9; i ++ )
             v.pb ( a[m] ), m ++;
        for ( int i = 0; i < v.size(); i ++ )
        {
            cnt = 0;
            for ( int j = 0; j < s.size(); j ++ )
                if ( v[i] == s[j] )
                    cnt ++;
            v1.pb ( cnt );

        }
        for ( int i = 0; i < v1.size(); i ++ )
              if ( v1[i] > 9 )
                cnt ++;
        if ( cnt >= 9 )
             cout << *min_element( v1.begin() , v1.end() );
        else
            cout << 0;
            */

            /*
            cin >> n;
            int a[n];
            for ( int i =0 ; i < n; i ++ )
                cin >> a[i];
            m = *min_element( a , a + n );
            for ( int i = 0; i < n; i ++ )
                if ( a[i] % m == 0 )
                    cnt ++;
            if ( cnt == n ) cout << m;
            else cout << -1;
            */

}

#include<bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int f = 0;
    for(int i = 0; i < n; i++) {
        if(i == 0 && a[i] > 15) {
            cout << 15;
            f = 1;
            break;
        }
        else if(i != 0 && a[i] - a[i - 1] > 15) {
            cout << a[i - 1] + 15;
            f = 1;
            break;
        }
    }
    if(f == 0) {
        if(15 * n > 90) {
            cout << 90;
        }
        else {
            cout << a[n - 1] + 15;
        }
    }
    return 0;
}

#include <iostream>
#include <vector>
using namespace std;
int n,m,b;
int a[100];
int main(){
	cin >>n;

for(int i=0;i<n;i++){
cin>>m;
}

for(int i=0;i<n;i++){
	b=a[i]-a[i-1];
if(b>15)
	cout<< a[i-1]+15;
else cout<< 90;}
return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int ara[100],n,i,cnt=0,p;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>ara[i];
    }
    if(ara[0]>15){
        cout<<"15"<<endl;
    }
    else{
        for(i=1;i<n;i++){
            if((ara[i]-ara[i-1])>15){
                p=ara[i-1];
                cnt++;
                break;
            }
        }
        if(cnt==0){
            cout<<"90"<<endl;
        }
        else{
            cout<<min(p+15,90)<<endl;
        }
    }
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int nofmin;
    int arrofgoodmin[90];
    int out1;
    int out2;
    int out3;

      cin>>nofmin;
      if (nofmin<1||nofmin>90)
      {
        cout<<"not accept";
        return 0;

      }

      for(int j=0;j<nofmin;j++)
      {
        cin>>arrofgoodmin[j];
        if(arrofgoodmin[j]<1||arrofgoodmin[j]>90)
        {
        cout<<"not accept";
        return 0;

        }

      }
      for(int k=0;k<nofmin-1;k++)
      {
      if(arrofgoodmin[0]>15)
      {
        cout<<"15 ";
        return 0;

      }

      else if((arrofgoodmin[k+1]-arrofgoodmin[k])>15)
      {
        out1=arrofgoodmin[k]+15;
        cout<<out1;
        return 0;
      }

      }

      if(arrofgoodmin[nofmin-1]==90)
      {
        if(arrofgoodmin[nofmin-1]-arrofgoodmin[nofmin-2]>15)
        {
         out2=arrofgoodmin[nofmin-2]+15;
         cout<<out2;
         return 0;

        }
        else
        {
        cout<<"90";
        return 0;
        }

      }

      else
      {
        if(90-arrofgoodmin[nofmin-1]>15)
        {
         int out3=arrofgoodmin[nofmin-1]+15;
         cout<<out3;
         return 0;

        }
        else
        {
          cout<<"90";
          return 0;
        }

      }
return 0;

      }

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n,a=0;
    cin >> n;
    vector <int> t(n);
    for(int i=0;i<n;i++)
    {
        cin >> t[i];
    }
    if(t[0]>15)
    {
        cout << "15";
    }
    else
    {
        if(n==1)
        {
            cout << t[0]+15;
        }
        else
        {
            for(int i=0;i<n;i++)
            {
                if(t[i]>t[i-1]+15)
                {
                    a=t[i-1]+15;
                    if(a<90)
                    {
                        cout << a;
                        return 0;
                    }
                    else
                    {
                        cout << "90";
                        return 0;
                    }
                }
            }
            if(t[n-1]+15>=90)
            {
                cout << "90";
            }
            else
            {
                cout << t[n-1] + 15;
            }
        }
    }

    return 0;
}

#include <iostream>
#include <stdio.h>
#include <map>
#include <vector>
#include <bitset>
#include <string>
#include <math.h>
#include <stack>
#include <queue>
#include <functional>
#include <conio.h>
#include <set>
#include <algorithm>
using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
#define FOR(i, j, n) for (int i = j; i < n; i++)
#define ROF(i, j, n) for (int i = j; i >= n; i--)
#define pp(a, b) make_pair(a, b)
#define SC(n) scanf("%d", &n)
#define SC2(n, m) scanf("%d%d", &n, &m)
#define SCf(n) scanf("%lf", &n)
#define SCs(s) scanf("%s", s);
#define MAX 200010

int n, a[105];

int main() {
	SC(n);
	a[0] = 0;
	FOR(i, 1, n + 1) SC(a[i]);
	int ans = 0;
	FOR(i, 1, n + 1) {
		if (a[i] - a[i - 1] >= 15) {
			ans += 15;
			break;
		}
		ans = a[i];
	}
	cout << ans << endl;
	return 0;
}

#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int ara[n+1];
    ara[0]=0;
    int sum=0;
    for(int i=1;i<=n;i++)
        cin>>ara[i];
    for(int i=1;i<=n;i++){
        if(ara[i]-ara[i-1]>15){
            sum+=15;
            cout<<sum<<endl;
            return 0;
        }
        else sum+=(ara[i]-ara[i-1]);
    }
    cout<<sum<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){

    int n, res = 0;
    int a , a2 = 0;
    int flag = 0;
    scanf("%d",&n);
    for(int i = 0 ; i < n ; i++){
        scanf("%d",&a);
        if(a - a2 <=15){
            res += a - a2;
            a2 = a;
        }else{
            if(flag == 0&&(res+15<=90)){
                res +=15;
                flag = 1;
            }else{
                if(flag == 0&&res+15>90){
                  res = 90;
                  flag = 1;
                }
            }
        }
    }
    if(flag == 0&&(res+15<=90)){
        res +=15;
        flag = 1;
    }
    if(res>=90) res = 90;
    printf("%d",res);

    return 0;
}

#include<iostream>
using namespace std;
#include <vector>

int main()
{
   vector<int> v;
   int n, i;
   int s,d;
   int count ;
   cin>>n;
   v.resize(n);

   for (i = 0; i < n; ++i)
   {
   		cin >> v[i];
   }
   count = v[0];
   s = v[0];
   if( n <= 2)
   		{
   			if(v[0] > 15)
   				count = 15;
   			else
   				if(v[1] - v[0] > 15)
   					count = v[0]+15;
   				else
   					count = v[1] + 15;
   		}
   		else
   if( s >15)
   		count = 15;
   	else

   for(i =0; i < (n-1); i++)
   {
    d = v[i+1] - v[i];

   	if(d > 15)
   		{
   			count = count ;
   			break;

}
   	else
   		if(v[i+1] > 75)
   		{
   			count = 90;
   			break;
   		}
   		else
   		count = v[i+1]+15;

}
   cout<<count;

   return 0;

  }

#include <bits/stdc++.h>
using namespace std;
int checkBoring(vector<int>& t) {
  if(t[0] > 15)
    return 15;
  for(int i = 1; i < t.size(); i++) {
    if(t[i - 1] +15 < t[i])
      return t[i-1]+15;
  }
  return t[t.size() - 1];
}
int main() {
  int n;
  cin >> n;
  vector<int> t(n,0);
  for(int i = 0; i < n; i++)
    cin >> t[i];
  cout << checkBoring(t);
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector <int> a;
    for(int i=0;i<n;i++){
        int val;
        cin>>val;
        a.push_back(val);
    }
    int t=0;
    int store=0;
    if(a[0]>15){
        store=0;
    }
    else{
        for(int i=0;i<n-1;i++){
            if(a[i+1]-a[i]>15){
                store=a[i];
                break;
            }
            else{
                store=a[i];
            }
        }
    }
    if(store+15<=90){
        cout<<store+15<<endl;
    }
    else if(75<=store<=90){
        cout<<90<<endl;
    }
    else{
        cout<<store<<endl;
    }
    return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n;
    cin>>n; int Max=0; int bien, check=1;
    vector<int> a;
    a.push_back(0);
    for(int i=1; i<n; i++) {
        cin>>bien; a.push_back(bien);
        if(a[i]-a[i-1]>15) {
            if(a[i-1]+15>=90) {
                cout<<90;
            }
            else {
                cout<<a[i-1]+15;
            }
            break;
        }
    }

}

#include<iostream>
using namespace std;

int main()
{
    int n;
    cin>>n;
    int *arr;
    arr=new int[90];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    int k=0;
    for(int i=0;i<n;i++){
        int t=arr[i];
        if(t-k>15){
            cout<<(k+15);
            return 0;
        }
        k=t;
    }
    delete [] arr;
    cout<<"90";
    return 0;
}

#include <iostream>
#include <vector>
using namespace std;
int n,b;

int main(){
	cin >>n;
	int a[30];

for(int i=0;i<n;i++){
	cin>>a[i];}
for(int i=0;i<n;i++)
if((a[i]-a[i-1])>=15){
	cout<< a[i-1]+15;
	return 0;}

for(int i=0;i<n;i++)
	if((a[i]-a[i-1])<15){
	 cout<< 90;
	 return 0;
	}
return 0;
}

//Kirienko Max
//
//
//

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>
#define hw "Hello world";
#define ll long long
#define vi(name,size) vector <int> name (size);
#define f(n) for(int i=0;i<n;i++)
#define pb push_back;
using namespace std;
vector <bool> used;
vector <vector<int> > g(5000);
void dfs (int v){
    used[v]=true;
    for (int i=0; i<g[v].size();i++){
        int to = g[v][i];
        if(!used[to])
            dfs(to);
    }
}
struct pt{
    double x,y;
    pt(){};
    pt(double x,double y)
    {
        this->x=x;
        this->y=y;
    }
    pt operator+(const pt& other) const{
        return pt(x+other.x, y+other.y);
    }
    pt operator-(const pt& other)const{
        return pt(x-other.x,y-other.y);
    }
    pt operator*(double k) const{
        return pt(x*k,y*k);
    }

    pt operator/(double k) const{
        return pt(x/k,y/k);
    }
    friend ostream & operator << (ostream& o,const pt &point)
    {
        o<<point.x<<" "<<point.y<<endl;
        return o;
    }
    double len() const{
        return sqrt(x*x+y*y);
    }
};
double vect(const pt & a, const pt &b){
    return a.x*b.y-b.x*a.y;
}
double scal (const pt&a,const pt &b){
    return a.x*b.x+a.y*b.y;
}
template<typename T> istream& operator>> (istream &in, vector<T> &a)
{
    for(int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T> ostream& operator<< (ostream &out, const vector<T> &a)
{
    for(int i = 0; i < a.size(); ++i)
        out << a[i] <<endl;
    return out;
}
int gcd (int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd (b, a % b);
}
vector <long long int> t(10000000,0);
int Build(int v,int l,int r,const vector<ll> &a){
    if (l==r)
        t[v]=a[l];
    else{
        int M=(l+r)/2;
        Build(2*v+1,l,M,a);
        Build(2*v+2,M+1,r,a);
        t[v]=min(t[2*v+1],t[2*v+2]);
    }
    return 0;
}
int settree(int v,int l,int r,int i,int x){
    if(l==r)
        t[v]=x;
    else{
        int M=(l+r)/2;
        if(i<=M) settree(2*v+1,l,M,i,x);
        else settree(2*v+2,M+1,r,i,x);
        t[v]=t[2*v+1]+t[2*v+2];
    }
    return 0;
}
long long int sum(int v,int l,int r,int L,int R){

    if(l==L && r==R)return t[v];
    int M=(L+R)/2;
    if(r<=M){

        return sum(2*v+1,l,r,L,M);
    }
    else if(l>M){
        return sum(2*v+2,l, r,M+1,R);
    }
    else{
        ll a,b;
        a=sum(2*v+1,l,M,0,M);
        b=sum(2*v+2,M+1,r,M+1,R);
        return a+b;
    }
}
int main()
{
    // cout.setf(ios::fixed);
    //cout.precision(5);
    // freopen("sum.in", "r", stdin);
    // freopen("sum.out", "w", stdout);

    int n;
    cin>>n;
    vector<int>arr(n);
    int answ=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    if(n==1){
        cout<<arr[0]+15;
        return 0;
    }
    if(arr[0]>15){
        cout<<15;
        return 0;
    }
    for(int i=0;i<n-1;i++){
        if(arr[i+1]-arr[i]>15)
            answ=arr[i]+15;
        else answ=90;
    }
    cout<<answ;
}

#include <bits/stdc++.h>
using namespace std;
vector<int>arr;
int main()
{
    int n,k,l,cnt=0; cin>>n;
    int suma = 0;
    arr.push_back(0);
    for(int i=0;i<n;i++)
    {
        int t; cin>>t;
        suma+=t;
        arr.push_back(t);
    }
    int i= 0;
    for( i=0;i+1<arr.size();i++)
    {
        if(abs(arr[i]-arr[i+1])>15)
        {
            cnt = arr[i];
             break;
        }
    }
    if( i == n) cout<<90<<endl;
    else cout<<cnt+15<<endl;
}

//http://codeforces.com/contest/673/problem/0

#include <iostream>

using namespace std;

int main () {
	int n; cin >> n;
	int mc = 0, sm = 0;
	int x; cin >> x;
	if (n == 1 && x < 15) { cout << x; return 0; }
	else if (x > 15) { cout << 15; return 0; }

	sm += x;

	for (int i = 1; i < n; ++i) {
		cin >> mc;
		if (mc - x > 15) {
			cout << sm + 15;
			return 0;
		}
		sm += (mc - sm);
		x = mc;
	}
	cout << 90;

	return 0;
}

#include <vector>
#include <iostream>

using namespace std;
vector<int> minutes;

int main()
{
	int n, t;
	cin >> n;

	for (int i = 0; i<n; i++)
	{
		cin >> t;
		minutes.push_back(t);
	}

	int x = 0;
	for (int i = 0; i < n - 1; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			if (minutes[0] > 15)
				x = 15;
			else if (minutes[j] - minutes[i] > 15)
				x = minutes[i] + 15;
			else if (90 - minutes[n - 2] <= 15)
				x = 90;
			else
				x = 90;
		}
	}

	cout << x;
	return 0;
}

//

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <list>

using namespace std;

int size_n;
int result = -1;
vector <int> el(0);

int main()
{
	int ii;

	cin >> size_n;

	el.resize(size_n + 1);

	for (ii = 0; ii < size_n; ii++)
		cin >> el[ii];

	el[size_n] = 0;

	sort(el.begin(), el.end());

	for (ii = 1; (ii <= size_n) && (result < 0); ii++)
	{
		if ((el[ii] - el[ii - 1]) >= 15)
			result = el[ii - 1] + 15;
	}

	if (result < 0)
		result = el[size_n] + 15;

	cout << min(90, result) << endl;

	return 0;
}

#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n;
    int dem=0;
    int tong=0;
    cin>>n;
    vector<int> v;
    v.resize(n);
    for(int i=1;i<=v.size();i++)
    {
        cin>>v[i];
    }
    v[0] =0;
    int dau = v[1]-v[0];
    for(int i=0;i<v.size();i++)
    {
            int tam = v[i+1] - v[i];
            if(dau > 15)
            {
                dem =1;
                break;
            }
            else
            {
                if(tam >15)
                {
                    dem++;
                }
                else
                {
                    tong += tam;
                }
            }
    }
    int result = dem*15+tong +15;
    if(result +15 >= 90)
    {
        cout<<90;
    }
    else{
        if(result <15)
        {
            result += 15;
            cout<<result;
        }
        else
        {
        cout<<result;
        }
    }
        return 0;
    }

#include <iostream>
using namespace std;

int main()
{
  int n;
  cin >> n;
  int t[n];
  int i;
  for(i=0; i<n; i++){
    cin >> t[i];
  }
  int now = 0;
  int s = 0;
  for(i=0; i<n; i++){
    if(t[i]-now > 15){
      s += 15;
      break;
    }
    else{
      s += t[i] - now;
      now = t[i];
    }
  }
  cout << s;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    int n,watches=0,u=0;

    cin>>(n);
    int a[n];
    cin>>(a[0]);
    if(a[0]>15){cout<<(15);u++;}
    else {
        for(int i=1;i<n;i++){
        cin>>(a[i]);
        if(a[i]-a[i-1]>15){
            cout<<(a[i-1]+15);
            u++;
            break;
        }
    }
    }
    if(u==0)
        cout<<(90);

    return 0;
}

//Kirienko Max
//
//
//

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>
#define hw "Hello world";
#define ll long long
#define vi(name,size) vector <int> name (size);
#define f(n) for(int i=0;i<n;i++)
#define pb push_back;
using namespace std;
vector <bool> used;
vector <vector<int> > g(5000);
void dfs (int v){
    used[v]=true;
    for (int i=0; i<g[v].size();i++){
        int to = g[v][i];
        if(!used[to])
            dfs(to);
    }
}
struct pt{
    double x,y;
    pt(){};
    pt(double x,double y)
    {
        this->x=x;
        this->y=y;
    }
    pt operator+(const pt& other) const{
        return pt(x+other.x, y+other.y);
    }
    pt operator-(const pt& other)const{
        return pt(x-other.x,y-other.y);
    }
    pt operator*(double k) const{
        return pt(x*k,y*k);
    }

    pt operator/(double k) const{
        return pt(x/k,y/k);
    }
    friend ostream & operator << (ostream& o,const pt &point)
    {
        o<<point.x<<" "<<point.y<<endl;
        return o;
    }
    double len() const{
        return sqrt(x*x+y*y);
    }
};
double vect(const pt & a, const pt &b){
    return a.x*b.y-b.x*a.y;
}
double scal (const pt&a,const pt &b){
    return a.x*b.x+a.y*b.y;
}
template<typename T> istream& operator>> (istream &in, vector<T> &a)
{
    for(int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T> ostream& operator<< (ostream &out, const vector<T> &a)
{
    for(int i = 0; i < a.size(); ++i)
        out << a[i] <<endl;
    return out;
}
int gcd (int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd (b, a % b);
}
vector <long long int> t(10000000,0);
int Build(int v,int l,int r,const vector<ll> &a){
    if (l==r)
        t[v]=a[l];
    else{
        int M=(l+r)/2;
        Build(2*v+1,l,M,a);
        Build(2*v+2,M+1,r,a);
        t[v]=min(t[2*v+1],t[2*v+2]);
    }
    return 0;
}
int settree(int v,int l,int r,int i,int x){
    if(l==r)
        t[v]=x;
    else{
        int M=(l+r)/2;
        if(i<=M) settree(2*v+1,l,M,i,x);
        else settree(2*v+2,M+1,r,i,x);
        t[v]=t[2*v+1]+t[2*v+2];
    }
    return 0;
}
long long int sum(int v,int l,int r,int L,int R){

    if(l==L && r==R)return t[v];
    int M=(L+R)/2;
    if(r<=M){

        return sum(2*v+1,l,r,L,M);
    }
    else if(l>M){
        return sum(2*v+2,l, r,M+1,R);
    }
    else{
        ll a,b;
        a=sum(2*v+1,l,M,0,M);
        b=sum(2*v+2,M+1,r,M+1,R);
        return a+b;
    }
}
int main()
{
    // cout.setf(ios::fixed);
    //cout.precision(5);
    // freopen("sum.in", "r", stdin);
    // freopen("sum.out", "w", stdout);

    int n;
    cin>>n;
    vector<int>arr(n);
    int answ=0;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    if(arr[0]>15){
        cout<<15;
        return 0;
    }
    for(int i=0;i<n-1;i++){
        if(arr[i+1]-arr[i]>15)
            answ=arr[i]+15;
        else answ=90;
    }
    cout<<answ;
}

#include<iostream>
#include<map>

using namespace std;
int main()
{
int n,i;
cin>>n;
int t[n];
cin>>t[0];
if(t[0]>15)
{cout<<15;
exit(0);
}
for( i=1;i<n;i++)
{
	cin>>t[i];
	if(t[i]-t[i-1]>15)
	{
		cout<<t[i-1]+15;
		exit(0);
	}

}

cout<<t[i-1];

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main(){

    int n, res = 0;
    int a , a2 = 0;
    int flag = 0;
    scanf("%d",&n);
    for(int i = 0 ; i < n ; i++){
        scanf("%d",&a);
        if(a - a2 <=15){
            res += a - a2;
            a2 = a;
        }else{
            if(flag == 0&&(res+15<=90)){
                res +=15;
                flag = 1;
            }else{
                if(flag == 0&&res+15>90){
                  res = 90;
                  flag = 1;
                }
            }
        }
    }
    if(flag == 0&&(res+15<=90)){
        res +=15;
        flag = 1;
    }
    if(res>=90) res = 90;
    printf("%d\n",res);

    return 0;
}

#include <iostream>
#include <vector>
#include <map>
#include <iterator>
#include <stack>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int *t = new int[n];
	int last = 0;
	cin >> t[0];
	last = t[0];
	for (int i = 1; i < n; i++)
	{
		cin >> t[i];
		if(t[i] - last > 15)
		{

			cout << last+15 << endl;
			return 0;
		}
		last = t[i];
	}
	cout << min(last+15, 90) << endl;
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int nofmin;
    int arrofgoodmin[90];
    int out1;
    int out2;
    int out3;
    cout<<"Enter total numbers of good minuites in the film\n";

      cin>>nofmin;
      if (nofmin<1||nofmin>90)
      {
        cout<<"not accept";
        return 0;

      }

      for(int j=0;j<nofmin;j++)
      {
        cin>>arrofgoodmin[j];
        if(arrofgoodmin[j]<1||arrofgoodmin[j]>90)
        {
        cout<<"not accept";
        return 0;

        }

      }
      for(int k=0;k<nofmin-1;k++)
      {
      if(arrofgoodmin[0]>15)
      {
        cout<<"closed at 15 ";
        return 0;

      }

      else if((arrofgoodmin[k+1]-arrofgoodmin[k])>15)
      {
        out1=arrofgoodmin[k]+15;
        cout<<out1;
        return 0;
      }

      }

      if(arrofgoodmin[nofmin-1]==90)
      {
        if(arrofgoodmin[nofmin-1]-arrofgoodmin[nofmin-2]>15)
        {
         out2=arrofgoodmin[nofmin-2]+15;
         cout<<out2;
         return 0;

        }
        else
        {
        cout<<"90";
        return 0;
        }

      }

      else
      {
        if(90-arrofgoodmin[nofmin-1]>15)
        {
         int out3=arrofgoodmin[nofmin-1]+15;
         cout<<out3;
         return 0;

        }
        else
        {
          cout<<"90";
          return 0;
        }

      }

      }

//DEEPANSHU SAXENA
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define DEBUG(x) cerr<< '"' << #x << '"' << " : " << x << endl;
#define ll long long
#define array(x,n) (x,x+n)
#define all(c) (c).begin(),(c).end()
#define VECTOR(v) cout << '>' << #v << ':' ; vector_out(v);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ip(x) cin>>x
#define op(x) cout<<x<<endl
#define db(x) cerr<<x<<endl
#define opn(x) cout<<x
#define ops(x) cout<<x<<" "
#define odd(x) (x&1)
#define dbs(x) cerr << x << " ";
#define dbn(x) cerr << x
#define Pll pair<ll,ll>
#define P_Pll_ll pair<Pll,ll>
#define VLL std::vector<ll>
#define VB std::vector<bool>
#define even(x) (!x&1)
#define cpresent(a,x) (find(all(a),x) != (a).end())
#define it(a,i) for(typeof((a).begin() i = (a).begin(); i != (a).end(); i++)
#define present(a,x) ((a).find(x) != (a).end())
#define fbei(i,x,y,z) for(ll i=x;i<=y;i+=z)
#define fbe(i,x,y) for(ll i=x;i<=y;i++)
#define feb(i,x,y)for(int i=x;i>=y;i--)
#define f(i,n) for(ll i=0;i<n;i++)
#define pb push_back
#define mp(x,y) make_pair(x,y)
#define GCD(x,y) __gcd(x,y)
#define out(x,n) cout<<fixed<<setprecision(n)<<x<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
vector<ll> vector_in(ll n)
{
    vector<ll> v(n);
    for(ll i=0;i<n;i++)
    cin>>v[i];
    return v;
}
void vector_out(vector<ll> v)
{
    for(ll i=0;i<v.size();i++)
    cout<<v[i]<<" ";
    cout<<endl;
}
ll vector_sum(vector<ll> v)
{
    ll sum;
    for(ll i=0;i<v.size();i++)
    sum+=v[i];
    return sum;
}
vector<string> GenerateTokens()
{
	string input;
	getline(cin,input);
	vector<string> inp;
	stringstream check1(input);
	string iter;
	while(getline(check1,iter,' '))
		inp.push_back(iter);
	return inp;
}
void Done()
{
	ll n;
	ip(n);
	std::vector<ll> x(n);
	f(iteratorr,n)
		ip(x[iteratorr]);
	if(n==1)
	{
		// op(x[0]);
		if(x[0]<=15)
			op(x[0]+15);
		else
			op("15");
		return;
	}

	if(x[0]>15)
	{
		op("15");
		return;
	}
	fbe(iteratorr,1,n-1)
	{
		// dbs(x[iteratorr]-x[iteratorr-1]);
		if(x[iteratorr]-x[iteratorr-1]>15)
		{
			op(x[iteratorr-1]+15);
			return;
		}
	}
	// op(x[n-1]);
	if(90-x[n-1]<=15)
		op("90");
	else
		op(x[n-1]);
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    freopen("errors.txt","w",stderr);
    #endif
    ll Test = 1LL;
    // ip(Test);
    while(Test--)
        Done();
}

#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll long long
vi arr;
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int t;
        cin>>t;
        arr.push_back(t);
    }
    if(arr.size()==1 && arr[0]<=15)cout<<arr[0]+15<<endl;
    if(arr[0]>15)
    {
        cout<<15<<endl;
        return 0;
    }
    for(int i=1;i<arr.size();i++)
    {
        if(arr[i]-arr[i-1]>15)
        {
            cout<<arr[i-1]+15<<endl;
            return 0;
        }
    }
    if(arr[n-1]<=85)cout<<arr[n-1]+15<<endl;
    else cout<<90<<endl;
}
//para cada uno sumar le 15 y tomar el mayor menor a

#include <iostream>

using namespace std;

int main(){
int n;
cin>>n;
int a[100000];
for (int i=0;i<n;i++)
{
	cin>>a[i];
}
if (15<a[0]){
	cout<<15;
	return 0;
}
else {
	for (int i=1;i<n;i++){
		if (a[i]-a[i-1]<15){
			continue;
		}
		else {
			cout<<a[i-1]+15;
			return 0;
		}
	}
}
cout<<90;
}

#include <iostream>
using namespace std;

//673A - Bear and Game

int main()
{
	int result = -1, n, *arr;
	cin >> n;
	arr = new int[n + 1];
	arr[0] = 0;
	for (int i = 1; i < n + 1; ++i)
		cin >> arr[i];
	for (int i = 0; i < n; ++i)
	{
		if (arr[i + 1] - arr[i] > 15)
		{
			result = arr[i] + 15;
			break;
		}
	}
	if (result == -1)
		if (arr[n] + 15 < 90)
			result = arr[n - 1] + 15;
		else
			result = 90;
	cout << result << endl;
	return 0;
}

#include<iostream>
using namespace std;
int main ()
{
	int n;
	int a[91];
	a[0]=0;
	int c = 0;
	while(cin>>n)
	{
		for (int i = 1; i<=n;i++)
		{
			cin>>a[i];
			if ((a[i]-a[i-1])>=15)
			{
				cout<<a[i-1]+15<<endl;
				c=1;
			}
		}
		if (c==1)
		{
			cout<<"90"<<endl;
		}
	}
	//system("pause");
	return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	vector<int> Watch;
	int SoPhut;
	cin >> SoPhut;

	for(int i = 0; i < SoPhut; i++)
	{
		int k;
		cin >> k;
		Watch.push_back(k);
	}
	int Total = 0;
	if(Watch[0] > 15)
	{
		Total += 15;

		cout << Total;

		return 0;
	}
	for(int i = 0; i < Watch.size()-1 ; i++)
	{

		if(Watch[i + 1] - Watch[i] <= 15 )
		{
			Total = Watch[i+1];
			if( i + 1 == Watch.size() )
			{
				Total = Watch[i+1] + 15;
				if(Total > 90)
				{
					Total = 90;
				}
			}
		}
		if(Watch[i+1] - Watch[i] > 15)
		{
			Total += 15;
			cout << Total;

			return 0;
		}
	}
	cout << Total;

	return 0;

}

#include<iostream>
#include<string>
#include<string.h>
#include<math.h>
using namespace std;

int main()
{

	int n;
	bool x = 0;
	cin >> n;
	int *b = new int[n];
	for (int i = 0; i < n; i++)
		cin >> b[i];
	if (n == 1)
	{

		cout << b[0] + 15;
		x = 1;
 return 0;
	}
	if (b[0]>15)
	{
		cout << 15;
		x = 1;
                return 0;
	}
	else
	{
		for (int i = 0; i < n - 1; i++)
		{
			if (b[i + 1] - b[i]>15)
			{
				cout << (b[i] + 15);
				x = 1;
				break;
			}
			else if (i + 2 == n  && x == 0&&(b[i+1]+15)<=90)
			{

				cout << b[i + 1] + 15;
				x = 1;
			}
		}
	}
	if (x==0)
		cout<< 90;

	return 0;
}

#include <iostream>

using namespace std;

int main(){
	/*int button_number;
	cin >> button_number;
	bool button;
	int total = 0;
	for (int i = 0; i < button_number; i++)
	{
		cin >> button;
		if (button == false)
			total++;
	}
	if (button_number == 1)
	{
		if (total == 0)
			cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	else
	{
		if (total == 1)
			cout << "YES" << endl;
		else cout << "NO" << endl;
	} */
	//system("pause");
	int happy_mins;
	int base = 0;
	int total = 0;
	int time = 0;
	int flag = 0;
	cin >> happy_mins;
	int mins;
	for (int i = 0; i < happy_mins; i++)
	{
		cin >> mins;
		if (flag == 0)
		{
			if ((mins - base) > 15)
			{
				total += 15;
				flag = 1;
			}
			else {
				time = mins - base;
				total += time;
				base = mins;
			}
			if (i == happy_mins - 1)
			{
				if (90 - mins <= 15)
					total = 90;
			}
		}
	}
	cout << total;
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
int n,i,ans=0;
cin>>n;
int a[n];
for(i=0;i<n;i++)
    cin>>a[i];
if(a[0]<=15 && n>1)
{
    ans=a[0];
    for(i=1;i<n;i++)
    {
        if(a[i]-a[i-1]<=15)
            ans=ans+(a[i]-a[i-1]);
        else
        {   ans=ans+15;
            break;
         }
    }
    if(i==n && 90-a[n-1]<=15)
        ans=90;
}
else if(a[0]>15 && n>1)
    ans=15;
else if(n==1)
{
    if(a[0]<=15)
        ans=a[0]+15;
    else
        ans=15;
}
cout<<ans;
    return 0;
}

#include<iostream>
using namespace std;

int main()
{
    int n;
    int arr[90];
    int game = 0;

    cin >> n;

    for(int i = 0; i < n; i++) {
        cin >> arr[i];
    }

    for(int j = 1; j <= n; j++) {
        if(arr[j] - arr[j-1] > 15) {
            if(arr[j-1] < 74) {
                game = arr[j-1] +15;
            }
            else game = 90;
            break;
        }
        else game = 90;
    }
     if(arr[0] > 15) {
        game = 15;

     }

     else if (n==1) {
        if(arr[0] < 15) {
            game = arr[0] + 15;

        }
        else game = 15;

     }
    cout << game << endl;
}

#include<iostream>

using namespace std;

int main(){

	int n, temp;
	int check = 0;

	cin >> n;
	cin >> temp;
	if (temp > 15)
	{
		cout << 15;
		return 0;
	}

	for (int i = 1; i < n; i++)
	{
		int x;
		cin >> x;

		if (temp + 15 < x)
		{
			check = 1;
			break;
		}
		temp = x;
	}

	if (check == 1 ||  temp <= 90 - 15)
	{
		cout << temp + 15;
	}
	else
	{
		cout << temp;
	}

	return 0;
}

// 673A
// Author: REET

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i=0; i<n; i++)
        cin >> v[i];
    if(n==1) {
        cout << v[0]+15 << endl;
        return 0;
    }
    if(v[0]>15) {
        cout << "15" << endl;
        return 0;
    }
    for(int i=0; i<n-1; i++) {
        if(v[i+1]-v[i]>15) {
            cout << v[i]+15 << endl;
            return 0;
        }
    }
    cout << "90" << endl;
    return 0;
}

#include<stdio.h>
int main()
{
    int n,i,t,a,b;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        a = t;
        scanf("%d",&t);
        if(i==1)
        {
            a = 0;
        }
        if(t-a>15)
        {
            printf("%d",a+15);break;
        }
        else if(i==n&&t==90)
        {
            printf("90");
        }
        else
        {
            printf("90");break;
        }
    }
    return 0;

}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n ;
    cin >> n ;
    int h[n] ;
    for(int i = 0 ; i < n ; i++)cin>>h[i] ;
    if(h[0]>15){cout << 15 ;return 0;}
    for(int i = 0 ; i < n-1 ; i++)if(h[i+1]-h[i]>=15){cout<<h[i]+15;return 0;}
    if(90 - h[n-1]>=15)cout<< h[n-1];
    else cout << 90 ;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

using vi = vector<int>;
#define pb push_back
#define pp pop_back

using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

int main(){

int n; cin >> n;

int start = 0;

int final;

vi t(n);

for(int i=0; i<n; i++){

    cin >> t[i];

    if((t[i]-start) > 15){
        final = start+15;
        break;
    } else {
        start = t[i];
    }

}

if(t[n-1] < 85 && final == 90){
    final = t[n-1] + 15;
}

if(final >= 90){
    cout << 90 << endl;
} else {
    cout << final << endl;
}

}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    int num[100];
    cin>>n;
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&num[i]);
    }
    int sum=15;
    if(num[1]>15)
    {
        cout<<sum;
    }
    else
    {
        int ck=1,i;
        for( i=1;i<n;i++)
        {
            if(num[i]+15>=num[i+1])
            {
                sum+=num[i+1];
            }
            else
            {
                cout<<sum<<endl;
                ck=0;
                break;
            }
        }
        if(i==n) cout<<"90";
        else if(ck==1) cout<<sum<<endl;
    }

    return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <iomanip>
#include <functional>
#include <string>
#include <stdio.h>

using namespace std;

#define ll long long
#define MAX 100000

int main()
{
	//freopen("a.in", "r", stdin);

	int n, arr[MAX], ans;

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];

	for (int i = 1; i < n; i++) {
		if (arr[i] - arr[i-1] > 15) {
			ans = arr[i-1] + 15;
			break;
		}
		else
			ans = arr[i-1] + 15;
	}

	if (arr[0] > 15)
		ans = 15;
	if (ans > 90)
		ans = 90;

	cout << ans << endl;
}

#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n];
	int out, count;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	if(n == 1){
		if(a[0] == 1){
			out = 15;
		}
	}
	if(a[0] > 15){
		out = 15;
	}else{
		for(int i = 0; i < n - 1; i++){
			count = a[i+1] - a[i];
			if(count > 15){
				out = a[i] + 15;
			}else{
				out = 90;
			}
		}
	}
	cout << out;
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stack>
#include <queue>
#include <string.h>
#include <cstdlib>
#include <stdio.h>
#include <sstream>
#include <vector>
#include <set>
#include <bitset>
#include <map>
using namespace std;

int main()
{
int x,n,i,j,k,h,l;
cin >>n;
n++;
int a[n];
a[0] = 0;
for(i=1;i<n;i++)
{
    cin >>a[i];
}
k=0;
for(i=1;i<n;i++)
{
    x = a[i]-a[i-1];
    if(x>15)
    {
        cout << k +15;
        return 0;
    }
    else
    {
         k+=x;
    }
}
cout << k;
    return 0;
}

#include <iostream>

using namespace std;
int a[100];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    cin>>a[i];
    int ans=90;
    for(int i=1;i<=n;i++)
    {
        if(a[i]-a[i-1]>=15)
        ans=a[i-1]+15;
        i=n+1;
    }
    cout<<ans;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()

{

    int n;
    int arr[90]= {0};
    cin>>n;
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];

    }
    int temp=0;
    int i,cou=0;
    for( i=0; i<n; i++)
    {

        if(arr[i]-temp>15)
        {
            cou=1;cout<<temp+15<<endl;return 0;
            break;
        }
        else temp=arr[i];
    }
     if(i==0)
    {
        cout<<15<<endl;
        return 0;
    }
    if(cou==1)
    {
        cout<<temp+15<<endl;
        return 0;
    }
    if(i==n-1&&cou==1)
    {
        cout<<temp+15<<endl;
        return 0;
    }

    cout<<90<<endl;

    return 0;
}

#include <iostream>

using namespace std;

int main()
{
int n,i,ans=0;
cin>>n;
int a[n];
for(i=0;i<n;i++)
    cin>>a[i];
if(a[0]<=15 && n>1)
{
    ans=a[0];
    for(i=1;i<n;i++)
    {
        if(a[i]-a[i-1]<=15)
            ans=ans+(a[i]-a[i-1]);
        else
        {   ans=ans+15;
            break;
         }
    }
    if(i==n && 90-a[n-1]<=15)
        ans=90;
        else
            ans=ans+15;
}
else if(a[0]>15 && n>1)
    ans=15;
else if(n==1)
{
    if(a[0]<=15)
        ans=a[0]+15;
    else
        ans=15;
}
cout<<ans;
    return 0;
}

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
int a[200];
int main()
{
	int n;
	while(~scanf("%d",&n)){
		memset(a,0,sizeof(a));
		int sum = 0;
		for(int i = 1; i <= n; i++) scanf("%d",&a[i]);
		if(a[1] > 15) {
			sum = 15;
			cout<<sum<<endl;
			return 0;
		}
		else {
			//sum = a[1];
			for(int i = 2; i <= n; i++){
				if(a[i] - a[i-1] > 15) {
					sum = a[i-1] + 15;
					cout<<sum<<endl;
					return 0;
				}
				else sum = a[i];
			}
		}
		if(sum < 90) sum = 90;
		cout<<sum<<endl;
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long n,i,p=15,c=0;
    cin>>n;
    long a[n+1]={0};
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(i=1;i<=n;i++)
    {
        if((a[i]-a[i-1])>=15)
        {cout<<a[i-1]+p;
        c++;
        break;}

    }
    if(c==0)
    cout<<a[n];
    return 0;
}

#include <iostream>
int main()
{
    int intrestmin;
    int temp = 0;
    int lastsum = 0;
    const int maxtime = 15;
    const int endtime = 90;

    std::cin >> intrestmin;

    int incorder[intrestmin];

    for(int i = 1; i <= intrestmin; i++){
        std::cin >> incorder[i];
        if(incorder[i] == 90){
            std::cout << "90";
        }
        int sum = incorder[i];

        if(sum - lastsum > maxtime){
            std::cout << lastsum + maxtime;
            break;
        }
        lastsum = sum;
    }
    if(lastsum + maxtime >= endtime){
        std::cout<< "90";
    }
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
	int n,a,b;
	cin>>n;
	cin>>a;
	for(int i=1;i<=n;i++)
	{
		cin>>b;
		if(b-a<=15)
			a=b;
		else if(b-a>15)
		{
			cout<<b+15<<endl;
			return 0;
		}
	}
	cout<<"90"<<endl;
	return 0;
 }

#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n;
	int temp;
	vector<int> vtime;

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> temp;
		vtime.push_back(temp);
	}

	if (vtime[0] > 15) {
		cout << "15";
		return 0;
	}

	int size = n - 1;

	for (int i = 0; i < size; ++i) {
		if (vtime[i] + 15 <= vtime[i + 1]) {
			cout << vtime[i] + 15;
			return 0;
		}
	}

	if (vtime[size] + 15 <= 90) {
		cout << vtime[size] + 15;
	}
	else {
		cout << "90";
	}

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n ;
    int a[n];
    cin >> a[0];
    if(a[0]>15)
    {
        cout<<15 ;
        return 0 ;
    }
    int sum = 0 ;
    for(int i=1;i<n;i++)
    {
        cin >> a[i];
        if(a[i] - a[i-1] < 15 ) sum = a[i] ;
        else break;
    }
    cout<<min(sum+15 , 90);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,c=15;
    cin>>n;
    int ara[n+1];
    ara[-1]=0;
    for(i=0;i<n;i++)
    {
        cin>>ara[i];
    }
    for(i=1;i<n;i++)
    {
        if((ara[i]-ara[i-1])>15)
        {
            c=ara[i-1];
            break;
        }
    }
    if((c+15)<=90)
    {
        cout<<c<<endl;
    }
    else
    {
        cout<<c<<endl;
    }
    return 0;
}

//libraries begin
#include<bits/stdc++.h>
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<utility>
#include<set>
#include<iterator>
#include <cctype>
//libaries end

//selfddefined macros begin
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define forn(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define s_s stable_sort
#define endl "\n"
#define bs(a,x) binary_search(a.begin(),a.end(),x)
#define pb push_back
#define tarz int t; cin>>t; while(t--)
#define int long long
typedef unsigned long long ull;
typedef long long ll;
typedef long double lld;
//selfdefined macros end

using namespace std;
int gcd(int a, int b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
bool isPrime(int n){
    if(n < 2)
        return false;
    if(n < 4)
        return true;
    if(n % 2 == 0 or n % 3 == 0)
        return false;
    for(int i = 5; i*i <= n; i += 6)
        if(n % i == 0 or n % (i+2) == 0)
            return false;
    return true;
}

/*getting all factors of x
  for(int i=1 ; i*i<=x ; i++){
	        if(x%i == 0){
	            v.push_back(i);
	            if(i*i != x)
	                v.push_back(x/i);
	        }
	    }*/
void swap(int &a,int &b)
{
    int t=a;
    a=b;
    b=t;
}

int sumdigits(int x)
{
    int sum=0;
    while(x)
    {
        int t=x%10;
        sum+=t;
        x/=10;
    }
    return sum;
}

bool norep(int x)
{
    map<int,int> m;
    while(x)
    {
        int t=x%10;
        m[t]++;
        if(m[t]>1)
        return false;
        x/=10;
    }
    return true;
}

const int N=90;
int32_t main()
{
    fio;
//   tarz
int n,a[N];
cin>>n;

forn(i,n) cin>>a[i];

if(a[0]>15)
{
cout<<15;
return 0;
}
int flag=0;
forn(i,n-1)
if(a[i+1]-a[i]>15)
{
cout<<a[i]+15<<endl;
flag=1;
}
if(!flag)
cout<<90;

return 0;
}

/*
██╗  ██████╗  ██╗    ██████╗  ██████╗  ██╗ █████╗
██║ ██╔═══██╗ ██║    ╚════██╗██╔═████╗███║██╔══██╗
██║ ██║   ██║ ██║     █████╔╝██║██╔██║╚██║╚██████║
██║ ██║   ██║ ██║    ██╔═══╝ ████╔╝██║ ██║ ╚═══██║
██║ ╚██████╔╝ ██║    ███████╗╚██████╔╝ ██║ █████╔╝
╚═╝  ╚═════╝  ╚═╝    ╚══════╝ ╚═════╝  ╚═╝ ╚════╝
*/
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define r_0 return 0
#define  ios_base::sync_with_stdio(0);
using namespace std;
float f, flo, fload=0;
ll int a,b,c = 0,d,e,n,m,cnt = 0, ans,cmd,i,j,x=1,v1,v2,t1,t2;
string s,g,o,h="hello",name;
vector< int >v;
vector< int >ve;
vector< int >vr;
int main()
{
   cin >> n;
        for ( int i=0; i<n; i++ )
        {
            cin >> a;
            v.pb(a);
        }
        for ( int i=0; i<n; i++ )
        {
            if ( v[0] > 15 )
            {
                cout << v[0];
                r_0;
            }
            if ( v[i] == 90 )
            {
                cout << v[i];
                r_0;
            }
            if( (v[i] + 15) < v[i+1] )
            {
                cout << v[i] + 15;
                r_0;
            }
        }

}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n, a[90], ans = 0, i = 0;
	for (cin >> n; i < n; i++)
		cin >> a[i];
	for (i = 0; i < n; i++)
	{
		if (ans += 15 < a[i])
			continue;
		else
			break;
		ans = a[i];
	}
	cout << ans << endl;
	return 0;
}

#include <iostream>
#include <vector>
using namespace std;

int main()
{
	vector<int> a, temp;
	int n;
	cin >> n;
	temp.resize(n);
	int tmp;
	a.push_back(0);
	for (int i = 0; i < n; i++)
	{
		cin >> tmp;
		a.push_back(tmp);
		temp[i] = a[i + 1] - a[i];
	}
	int check = 0;
	for (int i = 0; i < n; i++)
	{
		if (temp[i] > 15)
		{
			check = 1;
			cout << a[i] + 15 << endl;
			break;
		}
	}
	if (check == 0)
	{
		if (90 - a[n + 1] <= 15)
			cout << "90";
		else cout << a[n + 1] + 15;
	}
	return 0;
}

#include <iostream>
#include <vector>
using namespace std;
int n,m,b;

int main(){
	cin >>n;
	int a[100];

for(int i=0;i<n;i++){
cin>>a[i];
}

for(int i=0;i<n;i++){
	b=a[i]-a[i-1];
if(b>15)
	cout<< a[i-1]+15;
}
return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main() {

    int n,a[120],i,sum=0;
    cin >>n;
    a[0]=0;

            for(i=1;i<=n;i++)   {cin>>a[i];}

            for(i=1;i<=n+1;i++){

                      if(a[i]>a[i-1]+15) sum=a[i-1]+15;
                      else                sum=90;}

   cout <<sum;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n,t1,t2,t=0;
    cin>>n;
    t1=0;
    for(int i=1;i<=n;i++)
    {
        cin>>t2;

        if(t2-t1>15)
        {
            t+=15;
            cout<<t<<"\n";
            return 0;
        }
        t+=(t2-t1);
        t1=t2;
    }
     cout<<t<<"\n";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,tm=0,mr=90;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(a[0]>15)
    {
        cout<<15<<endl;
    }
    else if(n==1 & n<=15)
    {
        cout<<n+15<<endl;
    }
    else
    {
        for(int j=1;j<n;j++)
        {
           if(a[j]-a[j-1]>15 && mr>=15)
           {
               break;
           }
           else
           {
               tm=a[j];
               mr=90-a[j];
           }
        }
        if(mr>=15)
        {
            cout<<tm+15<<endl;
        }
        else if(mr<15)
        {
            cout<<90<<endl;
        }
    }
}

#include<iostream>
#include<math.h>
#include<string>
#include<string.h>
#include<vector>
using namespace std;

int main()
{
	int n;
	int kt=0;
	cin>>n;
	vector<int> a;
	for(int i=0;i<n;i++){
		int tam;
		cin>>tam;
		a.push_back(tam);
	}
	if(n==1&&a[0]<15)
		cout<<a[0]+15;
	else{
		if(n==1&&a[0]>=15)
			cout<<15;
		else{
			for(int i=0;i<a.size()-1;i++){

				if(a[0]>15){
					cout<<15;kt=1;break;
				}
				if((a[i+1]-a[i])>15){
					cout<<a[i]+15;
					kt=1;
					break;
				}
			}
			if(kt!=1){
				if(a[a.size()-1]>=85){
					cout<<90;
				}
				if(a[a.size()-1]<85){
					cout<<a[a.size()-1]+15;
				}
			}
		}
	}
	return 0;
}

#include<bits/stdc++.h>

using namespace std;
#define ll               long long
#define dl               double
#define ull              unsigned long long
#define ft               first
#define sd               second
#define pi               acos(-1)
#define ct(tc)           scanf("%lld",&tc)
#define scnm(n,m)        scanf("%lld %lld",&n,&m);
#define max3(a,b,c)      max(a,max(b,c))
#define max4(a,b,c,d)    max(a,max(b,max(c,d)))
#define min3(a,b,c)      min(a,min(b,c))
#define min4(a,b,c,d)    min(a,min(b,min(c,d)))
#define pb               push_back
#define srt              sort(v.begin(),v.end())
#define rsrt             reverse(v.begin(),v.end())
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll tc,i,d;
    ct(tc);
    ll arr[tc];
    for(i=0;i<tc;i++)
    {
        scanf("%lld",&arr[i]);
    }

    if(tc==1)
    {
        if(arr[0]>15)
        {
            d=15;
        }
        else
        {
            d=arr[0]+15;
        }
    }
    else
    {

    for(i=1;i<tc;i++)
    {
        if(arr[0]>15)
        {
            d=15;
            break;
        }
        else
        {
           if((arr[i]-(arr[i-1])<15))
           {
               d=arr[i];
               if((i==(tc-1))&&(arr[i]<90)&&(90-arr[i])<15)
                  {
                      d=90;
                      break;
                  }
           }
           else
           {
               d=arr[i-1]+15;
               break;
           }
        }
    }
    }

    cout<<d<<"\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n=0;
    bool b=false;
    cin >> n;

    int a[90];
    a[0] = 0;
    int i=1;

    for (; i<= n; ++i)
    {
         cin >>a[i];
         if(a[i-1]+15 < a[i]) {
             cout << a[i-1]+15 << " ";
             b = true;
         }
    }

    if(b == false && 90-a[i-1] > 15)
        cout << endl << a[i-1]+15;
    else
        cout << endl << 90-a[i-1];

    return 0;
}

/*
 * main.cpp
 *
 *  Created on: Mar 14, 2017
 *      Author: tsho
 */

#include <iostream>
#include <vector>
#include <math.h>
#include <conio.h>

using namespace std;

int main()
{
	int n;
	cin >> n ;

	vector<int> v;
	int temp;

	v.push_back(0);
	for(int i =0; i <n; i ++)
	{
		cin >> temp;
		v.push_back(temp);
	}

	int count =0;
	for(int i =0; i <n; i ++)
	{
		int k=0;
		for(int j =v[i]; j < v[i +1]; j++)
		{
			k++;
			count ++;
			if(k==15 && i !=0)
			{
				cout << count << endl;
				return 0;
			}

			if(k>15 && i ==0)
			{
				cout << 15 << endl;
				return 0;
			}
		}
	}
	cout << count << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int ara[100];
    int n,x=0,i;
    scanf("%d",&n);
    for(i=0; i<n; i++)
    {
        scanf("%d",&ara[i]);
    }
    for(i=0; i<n; i++)
    {

        if(ara[i+1]-ara[i]>15)
        {
            x=ara[i]+15;
            break;
        }
        else if(ara[0]>15)
        {
            x=15;
            break;
        }

    }
    if(x>90)x=90;
    printf("%d\n",x);
    return 0;
}

#include <iostream>
using namespace std;
int main()
{int n,t,m,sum=15;
cin>>n;
n=n-1;
        cin>>t;
        m=t;
        int c=m;
        if(m>15){
            sum=15;
        }
        if(n==0&&m<15){
            sum=15+t;
        }
        if(n!=0&&c<=15){

         while(n--){
            cin>>t;
            m=m+15;
            if(m>=t){
                sum=t+15;
                m=t;

            }
            else{ sum=m;
            break;}

         }
        }
        if(sum>=90){
            sum=90;
        }
            cout<<sum;

return 0;
}

#include<iostream>
using namespace std;
int main()
{
    int a[100],sum,k=0,i,j=90,n;
    cin>>n;
    a[0]=0;
    for(i=1;i<=n;i++)
        {
            cin>>a[i];
        }
    for(i=0;i<=n;i++)
        {
            if((a[i+1]-a[i])>=15)
            {
                k=1;
                break;
            }
        }
        if(k!=0) cout<<a[i]+15;
        else cout<<j;
        return 0;
}

#include <iostream>

int main() {
	int n = 0;
	std::cin >> n;

	int interestedMin = 0, numberOfMin = 0;

	for (int i = 0; i < n; ++i) {
		std::cin >> interestedMin;
		int distance = interestedMin - numberOfMin;
		if (distance > 15) {
			std::cout << numberOfMin + 15;
			return 0;
		}
		else {
			numberOfMin = interestedMin;
		}
	}
	std::cout << numberOfMin;
	return 0;
}

#include<iostream>
using namespace std;
int a[100];int b[100];
int main()
{	int n;	cin>>n;
	for(int i=0 ; i<n ; i++)
	{cin>>a[i];}	b[0]=a[0];
	for(int i=1 ; i<n ; i++){	b[i]=a[i]-a[i-1];}	int sum=0;
	for(int i=0 ;i<n ; i++)
	{if(b[i]>15)	{	sum+=15;	cout<<sum<<endl;
			return 0;}
sum+=b[i];}cout<<sum<<endl;

return 0;}

#include <iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n+2];
	a[0]=1;
	for (int i=1;i<=n;i++){
		cin>>a[i];
	}
	for (int i=0;i<=n;i++){
		if (a[i]-a[i-1]>=15){
			if (i==1){
				cout<<a[i-1]+14;
				return 0;
			}
			else{
			cout<<a[i-1]+15;
			return 0;
		}
		}
	}
	cout<<90;
	return 0;
}

#include <stdio.h>
#include <conio.h>
#define MAX 90
int main()
{
	int n,tong=90, a[MAX];
	do
	{
	scanf("%d",&n);
	}
	while(n<1&&n>90);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	if(a[0]>15)
	tong=15;
	else if(n==1)
	tong=a[0]+15;
	else
	{
	for(int i=0;i<n-1;i++)
	{
		int j=i+1;
		if((a[j]-a[i])>15)
		{
		tong=a[i]+15;
		break;
		}
	}
		}
	printf("%d",tong);
	return 0;
}

/*
 * Author: Mai
 * Created on May 14, 2016, 6:35 PM
 */

#include <iostream>

using namespace std;

int main() {

    int num_of_minutes;
    cin >> num_of_minutes;
    int* minutes_arr = new int[num_of_minutes];
    for (int i = 0; i < num_of_minutes; i++) {
        cin >> minutes_arr[i];
    }

    int i = 0, sum;
    if (minutes_arr[0] > 15) {
        sum = 15;
    } else {
        sum = minutes_arr[0];
        while (i < num_of_minutes - 1) {
            int x = minutes_arr[i + 1] - minutes_arr[i];
            if (x <= 15)
                sum += x;
            else {
                sum += 15;
                break;
            }
            i++;
        }
    }

    if (sum <= 90)
        cout << sum;
    else
        cout << 90;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n;
    long long sum=0;
    cin>>n;
    int arr[n];
    for(int i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    for(int i=0; i<n; i++)
    {
        if(arr[0]>15)
        {
            sum+=15;
            break;
        }
        if(i<n-1)
        {
            if(arr[i+1]-arr[i]<=15)
            {
                sum=arr[i+1];
            }
            if(arr[i+1]-arr[i]>15)
            {
                sum+=15;
            }
            if(i==n-1)
        {
            sum=90;
        }
        }

    }
    cout<<sum;
    return 0;
}

#include<bits/stdc++.h>
#define pb push_back
using namespace std;

int main(){
	int n;
	cin>>n;

	vector<int> v;

	for(int i=0;i<n;i++){
		int t;cin>>t;v.pb(t);
	}

	int ans=0;

	for(int i=0;i<n-1;i++){
		if((v[i+1]-v[i])>15){
			ans+=v[i]+15;
		}
		if(v[0]>15){
			ans=15;
		}
	}

	if(!ans){
		ans=v[n-1];
	}

	cout<<ans<<"\n";
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main (){
	int n,x=15;
	cin>>n;
	int a[n+1];
	for(int k=1;k<=n;k++)
	cin>>a[k];
	if(n==1 && n>15) {
	cout<<15; return 0;}
    if(n==1 && n<=15) {
    cout<<90; return 0;}
	a[0]=0;
	for(int k=1;k<=n;k++){
		if((a[k]-a[k-1])>15){ cout<<a[k-1]+15; break;}
		if(k==n) {cout<<90; return 0;}
	}
	return 0;
}

//

#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <list>

using namespace std;

int size_n;
int result = -1;
vector <int> el(0);

int main()
{
	int ii;

	cin >> size_n;

	el.resize(size_n + 1);

	for (ii = 0; ii < size_n; ii++)
		cin >> el[ii];

	el[size_n] = 1;

	sort(el.begin(), el.end());

	for (ii = 1; (ii <= size_n) && (result < 0); ii++)
	{
		if ((el[ii] - el[ii - 1]) >= 15)
			result = el[ii - 1] + 15;
	}

	if (result < 0)
		result = el[size_n] + 15;

	cout << min(90, result) << endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n, i, k=0, ans=0, d;
    long long int a[100005];
    a[0]=0;
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>a[i];
    }
    for(i=0; i<n; i++)
    {
        if(a[i]+15<a[i+1])
        {
            cout<<a[i]+15;
            return 0;
        }
        else
        {
            ans=ans+(a[i+1]-a[i]);
        }
    }
    if(ans>90) ans=90;
    cout<<ans;
    return 0;
}

#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n];
	int out, count;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	if(n == 1){
		if(a[0] == 1){
			out = 15;
		}
	}
	if(a[0] > 15){
		out = 15;
	}else{
		for(int i = 0; i < n - 1; i++){
			count = a[i+1] - a[i];
			if(count > 15){
				out = a[i] + 15;
			}else{
				out = 90;
			}
		}
	}
	cout << out;
	return 0;
}

#include <iostream>
int main()
{
    int intrestmin;
    int temp = 0;
    int lastsum = 0;
    const int maxtime = 15;
    const int endtime = 90;

    std::cin >> intrestmin;
    int incorder[intrestmin];

    if(intrestmin == 1 ){
        int temp2;
        std::cin >> temp2;
        if(temp2 == 1){
            std::cout << 1 + maxtime;
            return 0;
        }

        if(temp2 == 15){
            std::cout << maxtime * 2;
            return 0;
        }
    }

    for(int i = 1; i <= intrestmin; i++){

        std::cin >> incorder[i];

        int sum = incorder[i];

        if(sum - lastsum > maxtime){
            std::cout << lastsum + maxtime;
            break;
        }
        lastsum = sum;

        if(i == intrestmin && lastsum+5 < endtime){
            std::cout << lastsum + maxtime;
        }

    }
    if(lastsum + maxtime >= endtime){
        std::cout<< "90";
    }
    return 0;
}

#include<stdio.h>
#define MAX 90
int main(){
	int n;
	int a[MAX];
	int time=0; int check=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	for(int i=0;i<n;i++){
		check+=15;
		if(a[i]>check){
			if(i>0){
				time=a[i-1]+15;
				break;
			}
			else{
				time=15;
				break;
			}
		}
		else if(a[i]>time)
			time=a[i]+15;
		if(time>=90)
			time=90;
	}
	printf("%d",time);
	return 0;
}

#include<stdio.h>
int main()
{
    int n,i,t,a,b;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        a = t;
        scanf("%d",&t);
        if(i==1)
        {
            a = 0;
        }
        if(t-a>15)
        {
            printf("%d",a+15);break;
        }
        else if(i==n&&t-a<15)
        {
            printf("90");
        }
    }
    return 0;

}