#include <iostream>
using namespace std;
int main()
{
int n, temp, min = 2000000000;
cin >> n;
while (n--) {
cin >> temp;
if (temp%7==0&&temp<min) min = temp;
}
if (min == 2000000000) cout << "НЕТ";
else cout << min;
#include <iostream>
using namespace std;
int main()
{
int n, temp, min = 2000000000;
cin >> n;
while (n--) {
cin >> temp;
if (temp%7==0&&temp<min) min = temp;
}
if (min == 2000000000) cout << "НЕТ";
else cout << min;
}