class Solution {
    public long coloredCells(int n) {
        return 1 + 2l * n * (n - 1);
    }
}