#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d",&N);
  int A[N];
  int sum = 0;
  for(int i=0;i<N;i++){
    scanf("%d",&A[i]);
    if(A[i]>10){
      sum += A[i]-10;
    }
  }
  printf("%d",sum);
  
  return 0;
}
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int n;
int a[100010];
set<int> numSet;

int main()
{
	scanf("%d", &n);
	for (int i = 0 ; i < n ; i++) {
		scanf("%d", &(a[i]));
		numSet.insert(a[i]);
	}
	
	set<int>::iterator iBegin;
	set<int>::reverse_iterator iLast;
	
	while (numSet.size() > 1) {
		iBegin = numSet.begin();
		iLast = numSet.rbegin();
		int minNum = *iBegin;
		int maxNum = *iLast;
		
		numSet.erase(maxNum);
//		printf("%d\n", maxNum);
		maxNum = maxNum % minNum;
		if (maxNum == 0)
			maxNum = minNum;
		numSet.insert(maxNum);
	}
	
	iBegin = numSet.begin();
	int lastNum = *iBegin;
	
	
	printf("%d\n", lastNum);
	return 0;
}
