Button OnClick function?

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;

public class Codice : MonoBehaviour {
 public Text Inputfield;
 public Text Inputfield1;
 public Button cmdCalcola;
 
 public void Start()
 {
     var btt = gameObject.GetComponent<Button>();
     int n = System.Int32.Parse(Inputfield.text.ToString());
     int n1 = System.Int32.Parse(Inputfield1.text.ToString());
     string ris = ((n+n1)/2).ToString();
     btt.onClick.AddListener(() => {
         function(ris);
     });    
 }   
 void function(string a)
 {
     Debug.Log("The medium is: "+a);
 }

}

Why it gives this error in Console:" FormatException: Input string was not in the correct format System.Int32.Parse (System.String s) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int32.cs:629) Codice.Start () (at Assets/Codici/Codice.cs:16) ". How could i start this function. Excuse for my English

One of the strings you are trying to parse into an Int32 (via the System.Int32.Parse method) can’t be converted to an int. Write those two values out to the console prior to parsing them. What are the values? At least one can’t be converted to an int…