Create a count loop c#

I am using c# to create Macros through REVIT. what I am trying to do is to number objects in a certain order, they are sorted by level of placement. I want the code to loop through the first level, count the objects and number them, then go to the second level where it counts and start numbering with a reference from the level before
for example if the first set of objects were numbered from 1 to 10 then the next set of object will start numbering from 11 and till the count of this new set of objects so if they are 5 the numbering will be till 15 and so on

This is the code I tried. The problem is that the numbering now start each time at 1.

    public void UniqueTag()
     Document document = Application.ActiveUIDocument.Document;
     FilteredElementCollector collector = new FilteredElementCollector(document);
     IList<Element> AllWindows = collector.OfCategory(BuiltInCategory.OST_Windows).OfClass(typeof(FamilyInstance)).ToList();  // gets only placed instances       
     Transaction tran = new Transaction(document, "Tags Modification");
     foreach (Element window in AllWindows)

        string WindowLevel = window.LookupParameter("Level").AsValueString();
        FilteredElementCollector LevelCollector = new FilteredElementCollector(document);
        ICollection<Element> levels = LevelCollector.OfClass(typeof(Level)).ToElements();  
             foreach (Level le in levels)
                  var LevelName = le.Name;
                  if (WindowLevel == LevelName)
                    var query = from element in LevelCollector where element.Name == LevelName select element;
                    List<Element> level = query.ToList<Element>();
                    ElementId levelId = level[0].Id;    
                    ElementLevelFilter levelFilter = new ElementLevelFilter(levelId);
                    LevelCollector = new FilteredElementCollector(document);
                    ICollection<Element> allWindowssOnLevel = LevelCollector.OfCategory(BuiltInCategory.OST_Windows).OfClass(typeof(FamilyInstance)).WherePasses(levelFilter).ToElements();
                    int start = 1;
					int count = allWindowssOnLevel.Count;
					  for (int i = start; i <= count ; i++) // work correct for the first loop, need to be changed for the second loop 
					        foreach (Element e in allWindowssOnLevel)                
					                var tag = e.GetParameters("Tag#")[0].Set(i++);  
					              }//End of foreach allWindowssOnLevel
					        }//End of for

                      }//End of if 
                  }//End of forach levels
              }//End of foreachAllWindows

    } // End of UniqueTag