#include <bits/stdc++.h>
using namespace std;
int main() {
  int a = 0, output = 0, last = 1, i = 1, j = -1;
  cin >> a;
  for (int k = 1; k <= a; k++) {
    output = last + 2 * i + 2 * j;
    i += 2;
    j += 4;
    last = output;
  }
  cout << output;
  return 0;
}
