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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  
  for(int i = 0; i < N i++;)
    cin >> A[i];
  int M = 0;
  if (A[i]%3 != 0 && A[i]%5 != 0) {
    M + A[i];
  }
 cout >> M >>endl;
}
