#include<stdio.h> int main() { int n; while (~scanf("%d", &n)) { int a = 1; for (int i = 1; i <= n; i++) a *= 3; printf("%d\n", a - 1); } return 0; }