```python
def get_max_triples(n):
    """
    You are given a positive integer n. You have to create an integer array a of length n.
        For each i (1 ≤ i ≤ n), the value of a[i] = i * i - i + 1.
        Return the number of triples (a[i], a[j], a[k]) of a where i < j < k, 
    and a[i] + a[j] + a[k] is a multiple of 3.

    Example :
        Input: n = 5
        Output: 1
        Explanation: 
        a = [1, 3, 7, 13, 21]
        The only valid triple is (1, 7, 13).
    """
    # Compute a[i] mod 3 for each i from 1 to n
    # a[i] = i*i - i + 1
    # We need to count triples (i, j, k) with i < j < k such that
    # a[i] + a[j] + a[k] ≡ 0 (mod 3)
    
    # First, determine a[i] mod 3 for each i
    # a[i] = i^2 - i + 1
    # Let's compute i mod 3 and see what a[i] mod 3 is:
    # If i ≡ 0 mod 3: a[i] = 0 - 0 + 1 = 1 mod 3
    # If i ≡ 1 mod 3: a[i] = 1 - 1 + 1 = 1 mod 3
    # If i ≡ 2 mod 3: a[i] = 4 - 2 + 1 = 3 ≡ 0 mod 3
    
    # So:
    # i mod 3 == 0 -> a[i] mod 3 == 1
    # i mod 3 == 1 -> a[i] mod 3 == 1
    # i mod 3 == 2 -> a[i] mod 3 == 0
    
    # Count how many indices have each residue class mod 3
    # For i from 1 to n:
    # Count of i where i mod 3 == 0
    # Count of i where i mod 3 == 1
    # Count of i where i mod 3 == 2
    
    # Let c0 = count of i in [1, n] with i mod 3 == 0
    # Let c1 = count of i in [1, n] with i mod 3 == 1
    # Let c2 = count of i in [1, n] with i mod 3 == 2
    
    # a[i] mod 3:
    # - If i mod 3 == 0 or 1, then a[i] mod 3 == 1
    # - If i mod 3 == 2, then a[i] mod 3 == 0
    
    # So we have:
    # - Number of elements with a[i] mod 3 == 1: c0 + c1
    # - Number of elements with a[i] mod 3 == 0: c2
    # - Number of elements with a[i] mod 3 == 2: 0
    
    # We need triples where sum mod 3 == 0.
    # Possible combinations of residues (r1, r2, r3) that sum to 0 mod 3:
    # (0, 0, 0): sum = 0
    # (1, 1, 1): sum = 3 ≡ 0
    # (0, 1, 2): sum = 3 ≡ 0
    # (0, 2, 1): same as above
    # (1, 0, 2): same
    # (2, 0, 1): same
    # (2, 1, 0): same
    # (1, 2, 0): same
    # (2, 2, 2): sum = 6 ≡ 0
    
    # But we have no elements with residue 2, so combinations involving 2 are impossible.
    # So only possible:
    # - Three elements all with residue 0: C(c2, 3)
    # - Three elements all with residue 1: C(c0 + c1, 3)
    
    # Compute c0, c1, c2
    c0 = n // 3
    c1 = (n + 2) // 3  # numbers from 1 to n with i mod 3 == 1
    c2 = (n + 1) // 3  # numbers from 1 to n with i mod 3 == 2
    
    # Actually let's be more careful:
    # For i from 1 to n:
    # i mod 3 == 1: i = 1, 4, 7, ...
    # i mod 3 == 2: i = 2, 5, 8, ...
    # i mod 3 == 0: i = 3, 6, 9, ...
    
    # Count of i in [1, n] with i mod 3 == 1:
    # If n >= 1, the sequence is 1, 4, 7, ...
    # Count = floor((n - 1) / 3) + 1 if n >= 1
    # Or more simply: (n + 2) // 3
    
    # Count of i in [1, n] with i mod 3 == 2:
    # Sequence: 2, 5, 8, ...
    # Count = floor((n - 2) / 3) + 1 if n >= 2, else 0
    # Or: (n + 1) // 3
    
    # Count of i in [1, n] with i mod 3 == 0:
    # Sequence: 3, 6, 9, ...
    # Count = n // 3
    
    # Let's verify with n = 5:
    # i = 1: mod 3 == 1 -> a[1] mod 3 = 1
    # i = 2: mod 3 == 2 -> a[2] mod 3 = 0
    # i = 3: mod 3 == 0 -> a[3] mod 3 = 1
    # i = 4: mod 3 == 1 -> a[4] mod 3 = 1
    # i = 5: mod 3 == 2 -> a[5] mod 3 = 0
    
    # c0 (i mod 3 == 0): i = 3 -> count = 1
    # c1 (i mod 3 == 1): i = 1, 4 -> count = 2
    # c2 (i mod 3 == 2): i = 2, 5 -> count = 2
    
    # Elements with a[i] mod 3 == 1: c0 + c1 = 1 + 2 = 3
    # Elements with a[i] mod 3 == 0: c2 = 2
    # Elements with a[i] mod 3 == 2: 0
    
    # Triples with all residue 0: C(2, 3) = 0
    # Triples with all residue 1: C(3, 3) = 1
    # Total = 1 ✓
    
    def comb3(x):
        if x < 3:
            return 0
        return x * (x - 1) * (x - 2) // 6
    
    count_res0 = c2  # elements with a[i] mod 3 == 0
    count_res1 = c0 + c1  # elements with a[i] mod 3 == 1
    count_res2 = 0  # elements with a[i] mod 3 == 2
    
    total = comb3(count_res0) + comb3(count_res1)
    
    return total
```