#include <bits/stdc++.h>
using namespace std;
int N;
int main() {
  cin >> N;
  int A[N];
  int Q;
  int B[Q];
  int C[Q];
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      if (B[i] == A[j]) {
        A[j] = C[i];
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) sum = sum + A[i];
  cout << sum << endl;
}
