Calculation with Counting squares