#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin>>n;
  int d[n+1];
  for(int i=0;i<n;i++){
    cin>>d[i];
    d[i]+=24;
  }
  d[n]=24;
  sort(d,d+n+1);
  vector<int>v,w;
  int ans=100000;
  for(int i=0;i<n+1;i++){
    if(i%2==0){
      v.push_back(72-d[i]);
      v.push_back(48-d[i]);
      w.push_back(d[i]);
    }
    else{
      w.push_back(72-d[i]);
      w.push_back(48-d[i]);
      v.push_back(d[i]);
    }
  }
  sort(v.begin(),v.end());
  sort(w.begin(),w.end());
  for(int i=0;i<v.size()-1;i++){
    ans=min(ans,v[i+1]-v[i]);
  }
  for(int i=0;i<w.size()-1;i++){
    ans=min(ans,w[i+1]-w[i]);
  }
  cout<<ans<<endl;
}