#include <iostream>
using namespace std;
const int N = 1e5 + 5;
int main() {
int a[N];
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int sum = 0;
for (int i = 0; i < n; i++) {
sum += a[i];
}
int x = 0;
while (sum >= 10) {
x = sum % 10;
sum = sum / 10;
sum+=x;
}
cout << sum;
return 0;
}