
#include <stdio.h>

int calcTotalTax(int n, long amounts[]) {
    int totalTax = 0;

    for (int i = 0; i < n; i++) {
        if (amounts[i] > 1000) {
            // Calculate the taxable amount
            long taxableAmount = amounts[i] - 1000;
            // Calculate the tax (10% of the taxable amount)
            totalTax += taxableAmount / 10; // Integer division to ignore fractions
        }
    }

    return totalTax;
}

int main() {
    // Example test case
    long amounts[] = {1000, 2000, 3000, 4000, 5000};
    int n = 5;
    int totalTax = calcTotalTax(n, amounts);
    printf("%d\n", totalTax); // Output: 1000

    // Additional test cases
    long test1[] = {1000}; // Expected output: 0
    long test2[] = {2000}; // Expected output: 100
    long test3[] = {3000, 4000, 5000}; // Expected output: 900
    long test4[] = {1500, 2500, 3500, 4500}; // Expected output: 800
    long test5[] = {0, 500, 1000}; // Expected output: 0

    printf("%d\n", calcTotalTax(1, test1)); // Output: 0
    printf("%d\n", calcTotalTax(1, test2)); // Output: 100
    printf("%d\n", calcTotalTax(3, test3)); // Output: 900
    printf("%d\n", calcTotalTax(4, test4)); // Output: 800
    printf("%d\n", calcTotalTax(3, test5)); // Output: 0

    return 0;
}